/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF6B35;
    --primary-dark: #E55A2B;
    --secondary-color: #FFD23F;
    --accent-color: #FF6B9D;
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
    --text-light: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-light);
    overflow-x: hidden;
    position: relative;
}

/* ==================== 背景装饰 ==================== */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.light-ray {
    position: absolute;
    width: 200%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 214, 63, 0.3), transparent);
    animation: rayMove 8s linear infinite;
}

.light-ray-1 {
    top: 20%;
    transform: rotate(15deg);
    animation-delay: 0s;
}

.light-ray-2 {
    top: 50%;
    transform: rotate(-10deg);
    animation-delay: 2s;
}

.light-ray-3 {
    top: 80%;
    transform: rotate(5deg);
    animation-delay: 4s;
}

@keyframes rayMove {
    0% { transform: translateX(-100%) rotate(var(--rotation, 0deg)); }
    100% { transform: translateX(100%) rotate(var(--rotation, 0deg)); }
}

.star {
    position: absolute;
    color: var(--secondary-color);
    font-size: 20px;
    animation: twinkle 2s ease-in-out infinite;
}

.star-1 { top: 10%; left: 10%; animation-delay: 0s; }
.star-2 { top: 20%; right: 15%; animation-delay: 0.5s; }
.star-3 { top: 60%; left: 5%; animation-delay: 1s; }
.star-4 { bottom: 20%; right: 10%; animation-delay: 1.5s; }

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ==================== 容器 ==================== */
.container {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    min-height: 100vh;
}

/* ==================== 头部 ==================== */
.header {
    text-align: center;
    padding: 20px 0 30px;
}

.header-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: bounce 2s ease infinite;
    display: inline-block;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.title {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(255, 107, 53, 0.3);
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* ==================== 转盘区域 ==================== */
.wheel-container {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto 30px;
}

.wheel-outer-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    padding: 8px;
    box-shadow: 
        0 0 30px rgba(255, 107, 53, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.wheel-dots {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, 0.5);
    animation: rotate 20s linear infinite;
}

.wheel-dots span {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.wheel-dots span:nth-child(1) { top: 5%; left: 50%; transform: translateX(-50%); }
.wheel-dots span:nth-child(2) { top: 15%; right: 15%; }
.wheel-dots span:nth-child(3) { top: 50%; right: 5%; transform: translateY(-50%); }
.wheel-dots span:nth-child(4) { bottom: 15%; right: 15%; }
.wheel-dots span:nth-child(5) { bottom: 5%; left: 50%; transform: translateX(-50%); }
.wheel-dots span:nth-child(6) { bottom: 15%; left: 15%; }
.wheel-dots span:nth-child(7) { top: 50%; left: 5%; transform: translateY(-50%); }
.wheel-dots span:nth-child(8) { top: 15%; left: 15%; }
.wheel-dots span:nth-child(9) { top: 28%; right: 7%; }
.wheel-dots span:nth-child(10) { bottom: 28%; right: 7%; }
.wheel-dots span:nth-child(11) { bottom: 28%; left: 7%; }
.wheel-dots span:nth-child(12) { top: 28%; left: 7%; }

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.wheel-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.1);
}

#wheelCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ==================== 指针 ==================== */
.pointer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.pointer:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.pointer-triangle {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid var(--primary-color);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
    z-index: 11;
}

.pointer-triangle::after {
    content: '';
    position: absolute;
    top: -35px;
    left: -10px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 22px solid #fff;
}

.pointer-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px 5px rgba(255, 255, 255, 0.3);
    border: 3px solid #fff;
}

.pointer-text {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ==================== 抽奖次数 ==================== */
.chances-section {
    text-align: center;
    margin-bottom: 20px;
}

.chances-box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 24px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chances-label {
    font-size: 14px;
    color: var(--text-muted);
}

.chances-count {
    font-size: 28px;
    font-weight: 700;
    color: var(--secondary-color);
    text-shadow: 0 0 10px rgba(255, 214, 63, 0.5);
}

.chances-unit {
    font-size: 14px;
    color: var(--text-muted);
}

/* ==================== 操作按钮 ==================== */
.action-section {
    text-align: center;
    margin-bottom: 30px;
}

.btn-draw {
    position: relative;
    width: 200px;
    height: 50px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-draw:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

.btn-draw:not(:disabled):active {
    transform: translateY(0);
}

.btn-draw:disabled {
    background: linear-gradient(135deg, #666, #444);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.draw-tip {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ==================== 中奖记录 ==================== */
.records-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--secondary-color);
}

.title-icon {
    font-size: 18px;
}

.records-list {
    max-height: 150px;
    overflow-y: auto;
}

.record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

.record-item:last-child {
    border-bottom: none;
}

.record-item.empty {
    justify-content: center;
    color: var(--text-muted);
    padding: 20px 0;
}

.record-prize {
    color: var(--secondary-color);
    font-weight: 500;
}

.record-time {
    color: var(--text-muted);
    font-size: 12px;
}

/* ==================== 活动规则 ==================== */
.rules-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rules-content {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-muted);
}

.rules-content p {
    margin-bottom: 8px;
}

/* ==================== 中奖弹窗 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #2a2a4a, #1a1a2e);
    border-radius: 24px;
    width: 90%;
    max-width: 340px;
    overflow: hidden;
    animation: modalPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 214, 63, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

@keyframes modalPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-header {
    position: relative;
    padding: 40px 20px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 214, 63, 0.1));
}

.confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.confetti span {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out infinite;
}

.confetti span:nth-child(1) { left: 10%; background: #FF6B35; animation-delay: 0s; }
.confetti span:nth-child(2) { left: 30%; background: #FFD23F; animation-delay: 0.2s; }
.confetti span:nth-child(3) { left: 50%; background: #FF6B9D; animation-delay: 0.4s; }
.confetti span:nth-child(4) { left: 70%; background: #6BCB77; animation-delay: 0.6s; }
.confetti span:nth-child(5) { left: 90%; background: #4D96FF; animation-delay: 0.8s; }
.confetti span:nth-child(6) { left: 20%; background: #FFD23F; animation-delay: 1s; }

@keyframes confettiFall {
    0% { transform: translateY(-100%) rotate(0deg); opacity: 1; }
    100% { transform: translateY(200px) rotate(720deg); opacity: 0; }
}

.prize-icon {
    font-size: 64px;
    animation: prizeBounce 1s ease infinite;
}

@keyframes prizeBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.modal-body {
    padding: 20px;
    text-align: center;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.modal-prize {
    font-size: 18px;
    color: #fff;
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.modal-footer {
    padding: 0 20px 30px;
    text-align: center;
}

.btn-confirm {
    width: 160px;
    height: 44px;
    border: none;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* ==================== Toast 提示 ==================== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 2000;
    transition: all 0.3s ease;
}

.toast.active {
    transform: translate(-50%, -50%) scale(1);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.85);
    padding: 16px 24px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #6BCB77;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.toast-message {
    color: #fff;
    font-size: 15px;
    font-weight: 500;
}

/* ==================== 演示按钮 ==================== */
.demo-section {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.btn-demo {
    padding: 10px 20px;
    border: 1px dashed rgba(255, 214, 63, 0.5);
    border-radius: 20px;
    background: rgba(255, 214, 63, 0.1);
    color: var(--secondary-color);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-demo:hover {
    background: rgba(255, 214, 63, 0.2);
    border-style: solid;
}

/* ==================== 响应式适配 ==================== */
@media (max-width: 375px) {
    .wheel-container {
        width: 280px;
        height: 280px;
    }
    
    .title {
        font-size: 24px;
    }
    
    .pointer-circle {
        width: 70px;
        height: 70px;
    }
    
    .pointer-text {
        font-size: 12px;
    }
}

@media (min-width: 481px) {
    .container {
        padding: 40px 24px;
    }
    
    .wheel-container {
        width: 360px;
        height: 360px;
    }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
