/* 全局样式重置+基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

/* 4套预设背景样式 */
body.bg-default {
    background: linear-gradient(120deg, #f0f9ff 0%, #e6f7ff 50%, #d1edff 100%);
    background-attachment: fixed;
    background-size: cover;
}
body.bg-fresh {
    background: linear-gradient(120deg, #fdf2f8 0%, #fef7fb 50%, #e8f4f8 100%);
    background-attachment: fixed;
    background-size: cover;
}
body.bg-simple {
    background: linear-gradient(120deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    background-size: cover;
}
body.bg-warm {
    background: linear-gradient(120deg, #fff3e0 0%, #ffe0b2 50%, #ffcc80 100%);
    background-attachment: fixed;
    background-size: cover;
}
/* 本地上传背景的通用样式 */
body.bg-local {
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
}

/* 刮刮卡样式：适配所有背景，视觉协调 */
.lottery-box {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    max-width: 260px;
    margin: 0 auto;
    border: 3px solid #4aa0e6;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}
/* 不同背景下的刮刮卡边框适配 */
body.bg-fresh .lottery-box { border-color: #e85d75; }
body.bg-simple .lottery-box { border-color: #6c8ebf; }
body.bg-warm .lottery-box { border-color: #ff9800; }
body.bg-local .lottery-box { border-color: #4aa0e6; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); }

body {
    min-height: 100vh;
    padding: 20px 10px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: background 0.5s ease;
}

.container {
    width: 100%;
    max-width: 1400px;
    text-align: center;
    padding: 0 20px;
}

h1 {
    color: #2a78b8;
    font-size: 32px;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(42, 120, 184, 0.1);
}
body.bg-fresh h1 { color: #c43d58; }
body.bg-simple h1 { color: #4a6fa5; }
body.bg-warm h1 { color: #e65100; }
body.bg-local h1 { color: #2a78b8; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }

.sub-title {
    color: #668eb3;
    font-size: 16px;
    margin-bottom: 20px;
}
body.bg-fresh .sub-title { color: #d15a70; }
body.bg-simple .sub-title { color: #6b8cb8; }
body.bg-warm .sub-title { color: #f57c00; }
body.bg-local .sub-title { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }

/* 功能控制栏样式：适配新增的【设置弹窗延时】按钮 */
.func-control-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.func-control-bar button {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #ffffff;
    border: 2px solid #4aa0e6;
    color: #4aa0e6;
}
body.bg-fresh .func-control-bar button { border-color: #e85d75; color: #e85d75; }
body.bg-simple .func-control-bar button { border-color: #6c8ebf; color: #6c8ebf; }
body.bg-warm .func-control-bar button { border-color: #ff9800; color: #ff9800; }
body.bg-local .func-control-bar button { border-color: #4aa0e6; color: #4aa0e6; background: rgba(255,255,255,0.9); }

.func-control-bar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(74,160,230,0.15);
}
body.bg-fresh .func-control-bar button:hover { box-shadow: 0 4px 10px rgba(232,93,117,0.15); }
body.bg-simple .func-control-bar button:hover { box-shadow: 0 4px 10px rgba(108,142,191,0.15); }
body.bg-warm .func-control-bar button:hover { box-shadow: 0 4px 10px rgba(255,152,0,0.15); }

/* 刮刮卡网格容器：固定5列，5×4排20张卡 */
.lottery-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
}

/* 奖项文字：适配5列小卡，防溢出、居中美观 */
.prize-result {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(14px, 2vw, 20px);
    font-weight: bold;
    color: #e64a4a;
    z-index: 1;
    letter-spacing: 0.5px;
    padding: 8px;
    word-break: break-word;
    line-height: 1.3;
    text-align: center;
}
.prize-result.active {
    transform: scale(1.05);
}

/* 刮奖画布：铺满卡片，刮奖区域 */
.lottery-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    background-color: transparent;
    cursor: pointer;
}

/* 全局按钮组：多背景适配 */
.global-btn-group {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 40px; /* 增加底部间距，给备案版权留位置 */
}
.global-btn-group button {
    padding: 12px 20px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

#resetAllBtn {
    background-color: #4aa0e6;
    color: #ffffff;
    transition: background 0.5s ease;
}
body.bg-fresh #resetAllBtn { background-color: #e85d75; }
body.bg-simple #resetAllBtn { background-color: #6c8ebf; }
body.bg-warm #resetAllBtn { background-color: #ff9800; }
body.bg-local #resetAllBtn { background-color: #4aa0e6; }

#resetAllBtn:hover {
    background-color: #2a78b8;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(42, 120, 184, 0.2);
}
body.bg-fresh #resetAllBtn:hover { background-color: #c43d58; box-shadow: 0 6px 15px rgba(196,61,88,0.2); }
body.bg-simple #resetAllBtn:hover { background-color: #4a6fa5; box-shadow: 0 6px 15px rgba(74,111,165,0.2); }
body.bg-warm #resetAllBtn:hover { background-color: #e65100; box-shadow: 0 6px 15px rgba(230,81,0,0.2); }

#settingBtn, #cardNumBtn, #limitNumBtn, #resetDefaultBtn, #bgSettingBtn, #delayTimeBtn {
    background-color: #ffffff;
    border: 2px solid #4aa0e6;
    transition: all 0.5s ease;
}
body.bg-fresh #settingBtn, body.bg-fresh #cardNumBtn, body.bg-fresh #limitNumBtn, body.bg-fresh #resetDefaultBtn, body.bg-fresh #bgSettingBtn, body.bg-fresh #delayTimeBtn { border-color: #e85d75; }
body.bg-simple #settingBtn, body.bg-simple #cardNumBtn, body.bg-simple #limitNumBtn, body.bg-simple #resetDefaultBtn, body.bg-simple #bgSettingBtn, body.bg-simple #delayTimeBtn { border-color: #6c8ebf; }
body.bg-warm #settingBtn, body.bg-warm #cardNumBtn, body.bg-warm #limitNumBtn, body.bg-warm #resetDefaultBtn, body.bg-warm #bgSettingBtn, body.bg-warm #delayTimeBtn { border-color: #ff9800; }
body.bg-local #settingBtn, body.bg-local #cardNumBtn, body.bg-local #limitNumBtn, body.bg-local #resetDefaultBtn, body.bg-local #bgSettingBtn, body.bg-local #delayTimeBtn { border-color: #4aa0e6; background: rgba(255,255,255,0.9); }

/* 弹窗通用样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* 背景设置弹窗样式 */
.bg-modal-content {
    max-width: 600px;
    padding: 25px;
}
.bg-preset-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}
.bg-preset-item {
    cursor: pointer;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}
.bg-preset-item:hover {
    border-color: #4aa0e6;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(74,160,230,0.1);
}
body.bg-fresh .bg-preset-item:hover { border-color: #e85d75; }
body.bg-simple .bg-preset-item:hover { border-color: #6c8ebf; }
body.bg-warm .bg-preset-item:hover { border-color: #ff9800; }

.bg-preset-preview {
    width: 100%;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 8px;
}
.bg-preset-item p {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* 本地图片上传样式 */
.bg-upload {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}
.bg-upload-btn {
    display: inline-block;
    padding: 10px 30px;
    background-color: #4aa0e6;
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}
body.bg-fresh .bg-upload-btn { background-color: #e85d75; }
body.bg-simple .bg-upload-btn { background-color: #6c8ebf; }
body.bg-warm .bg-upload-btn { background-color: #ff9800; }
body.bg-local .bg-upload-btn { background-color: #4aa0e6; }

.bg-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(74,160,230,0.2);
}
.bg-upload-tip {
    margin-top: 10px;
    font-size: 12px;
    color: #999;
}

/* 中奖提示弹窗样式 */
.prize-tip-content {
    text-align: center;
    padding: 30px 20px;
    animation: bounceIn 0.5s ease;
}
@keyframes bounceIn {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
#prizeTipTitle {
    color: #ff9800;
    font-size: 26px;
    margin-bottom: 20px;
}
#prizeTipText {
    font-size: 20px;
    color: #e64a4a;
    margin-bottom: 25px;
}
#closePrizeTipBtn {
    padding: 10px 30px;
    background-color: #ff9800;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
}
#closePrizeTipBtn:hover {
    background-color: #f57c00;
    transform: translateY(-2px);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}
.close-btn:hover {
    color: #e64a4a;
}

.modal-content h3 {
    color: #2a78b8;
    margin-bottom: 10px;
    font-size: 22px;
}
body.bg-fresh .modal-content h3 { color: #c43d58; }
body.bg-simple .modal-content h3 { color: #4a6fa5; }
body.bg-warm .modal-content h3 { color: #e65100; }
body.bg-local .modal-content h3 { color: #2a78b8; }

.modal-tip {
    color: #999;
    font-size: 14px;
    margin-bottom: 20px;
    text-align: left;
}

/* 概率总和提示 */
.rate-total {
    color: #666;
    font-size: 15px;
    margin-bottom: 20px;
    text-align: left;
}
.rate-total span {
    color: #e64a4a;
    font-weight: bold;
}

.prize-set-list {
    margin-bottom: 25px;
    max-height: 400px;
    overflow-y: auto;
}

/* 奖项项布局：适配10个奖项，防溢出 */
.prize-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 10px 0;
    gap: 8px;
    flex-wrap: wrap;
}
.prize-item label {
    color: #666;
    font-size: 15px;
    white-space: nowrap;
}
.prize-input {
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
    flex: 1;
    min-width: 100px;
}
.prize-input:focus {
    border-color: #4aa0e6;
}
body.bg-fresh .prize-input:focus { border-color: #e85d75; }
body.bg-simple .prize-input:focus { border-color: #6c8ebf; }
body.bg-warm .prize-input:focus { border-color: #ff9800; }

/* 概率滚动滑块样式 */
.rate-slider {
    flex: 2;
    min-width: 100px;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}
.rate-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4aa0e6;
    cursor: pointer;
    transition: background 0.3s;
}
body.bg-fresh .rate-slider::-webkit-slider-thumb { background: #e85d75; }
body.bg-simple .rate-slider::-webkit-slider-thumb { background: #6c8ebf; }
body.bg-warm .rate-slider::-webkit-slider-thumb { background: #ff9800; }

.rate-slider::-webkit-slider-thumb:hover {
    background: #2a78b8;
}
body.bg-fresh .rate-slider::-webkit-slider-thumb:hover { background: #c43d58; }
body.bg-simple .rate-slider::-webkit-slider-thumb:hover { background: #4a6fa5; }
body.bg-warm .rate-slider::-webkit-slider-thumb:hover { background: #e65100; }

/* 概率滑块数值显示 */
.rate-value {
    color: #4aa0e6;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}
body.bg-fresh .rate-value { color: #e85d75; }
body.bg-simple .rate-value { color: #6c8ebf; }
body.bg-warm .rate-value { color: #ff9800; }

/* 数量/次数/延时输入框样式 */
.rate-input {
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s;
    width: 70px;
}
.rate-input:focus {
    border-color: #4aa0e6;
}
body.bg-fresh .rate-input:focus { border-color: #e85d75; }
body.bg-simple .rate-input:focus { border-color: #6c8ebf; }
body.bg-warm .rate-input:focus { border-color: #ff9800; }

#savePrizeBtn, #saveCardNumBtn, #saveLimitNumBtn, #saveDelayTimeBtn {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-radius: 8px;
    background-color: #4aa0e6;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}
body.bg-fresh #savePrizeBtn, body.bg-fresh #saveCardNumBtn, body.bg-fresh #saveLimitNumBtn, body.bg-fresh #saveDelayTimeBtn { background-color: #e85d75; }
body.bg-simple #savePrizeBtn, body.bg-simple #saveCardNumBtn, body.bg-simple #saveLimitNumBtn, body.bg-simple #saveDelayTimeBtn { background-color: #6c8ebf; }
body.bg-warm #savePrizeBtn, body.bg-warm #saveCardNumBtn, body.bg-warm #saveLimitNumBtn, body.bg-warm #saveDelayTimeBtn { background-color: #ff9800; }

#savePrizeBtn:hover, #saveCardNumBtn:hover, #saveLimitNumBtn:hover, #saveDelayTimeBtn:hover {
    background-color: #2a78b8;
}
body.bg-fresh #savePrizeBtn:hover, body.bg-fresh #saveCardNumBtn:hover, body.bg-fresh #saveLimitNumBtn:hover, body.bg-fresh #saveDelayTimeBtn:hover { background-color: #c43d58; }
body.bg-simple #savePrizeBtn:hover, body.bg-simple #saveCardNumBtn:hover, body.bg-simple #saveLimitNumBtn:hover, body.bg-simple #saveDelayTimeBtn:hover { background-color: #4a6fa5; }
body.bg-warm #savePrizeBtn:hover, body.bg-warm #saveCardNumBtn:hover, body.bg-warm #saveLimitNumBtn:hover, body.bg-warm #saveDelayTimeBtn:hover { background-color: #e65100; }

/* 响应式适配：大屏5列，中屏4/3列，小屏2/1列 */
@media (max-width: 1200px) {
    .lottery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    .lottery-box {
        max-width: 240px;
    }
    .bg-preset-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 900px) {
    .lottery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 600px) {
    .lottery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .func-control-bar {
        gap: 10px;
    }
    .func-control-bar button {
        padding: 6px 12px;
        font-size: 13px;
    }
    .global-btn-group button {
        padding: 10px 15px;
        font-size: 14px;
    }
    .bg-preset-list {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 400px) {
    .lottery-grid {
        grid-template-columns: 1fr;
    }
    h1 {
        font-size: 26px;
    }
    .modal-content {
        padding: 20px;
    }
    .bg-modal-content {
        padding: 20px 15px;
    }
}

/* 底部ICP备案+版权声明样式（适配所有背景+响应式） */
.page-footer {
    width: 100%;
    margin-top: 20px;
    padding: 20px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    color: #666;
    font-size: 14px;
}
/* 不同背景下的底部样式适配 */
body.bg-fresh .page-footer { color: #888; background: rgba(255,255,255,0.85); }
body.bg-simple .page-footer { color: #555; background: rgba(255,255,255,0.85); }
body.bg-warm .page-footer { color: #777; background: rgba(255,255,255,0.85); }
body.bg-local .page-footer { color: #fff; background: rgba(0,0,0,0.5); text-shadow: 0 1px 2px rgba(0,0,0,0.3); }

/* ICP备案信息样式 */
.icp-info {
    margin-bottom: 8px;
    font-weight: 500;
}
/* 版权声明样式 */
.copyright {
    font-size: 12px;
    line-height: 1.5;
}
/* 小屏响应式：缩小字体和内边距 */
@media (max-width: 400px) {
    .page-footer {
        padding: 15px 10px;
        font-size: 13px;
    }
    .copyright {
        font-size: 11px;
    }
}