@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;700&display=swap');

:root {
    --bg-gradient-start: #0f0c29;
    --bg-gradient-mid: #302b63;
    --bg-gradient-end: #24243e;
    --primary-glow: #a972ff;
    --secondary-glow: #ff72e5;
    --text-color: #f0f0f0;
    --highlight-color: #ffffff;
}

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

body, html {
    width: 100%;
    height: 100%;
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
    overflow: hidden;
    color: var(--text-color);
}

/* 动态星空背景 */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    pointer-events: none;
}

.star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    animation: twinkle 5s infinite ease-in-out;
    box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 40px var(--primary-glow);
}

/* 随机生成一些星星 */
.star:nth-child(1) { width: 2px; height: 2px; top: 20%; left: 15%; animation-delay: 0s; }
.star:nth-child(2) { width: 1px; height: 1px; top: 50%; left: 40%; animation-delay: 1.5s; }
.star:nth-child(3) { width: 3px; height: 3px; top: 80%; left: 70%; animation-delay: 3s; }
.star:nth-child(4) { width: 1px; height: 1px; top: 10%; left: 85%; animation-delay: 2s; }
.star:nth-child(5) { width: 2px; height: 2px; top: 60%; left: 10%; animation-delay: 4s; }

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

/* 主容器 */
.lottery-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100vh;
    padding: 40px 20px;
    text-align: center;
}

/* 头部标题 */
.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--primary-glow), 0 0 20px var(--secondary-glow);
}

.header p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
}

/* 奖品展示窗口 - 玻璃拟态效果 */
.prize-window {
    width: 90%;
    max-width: 400px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    overflow: hidden;
    position: relative;
    margin: 40px 0;
}

/* 奖品高亮线 */
.prize-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--secondary-glow), transparent);
    transform: translateY(-50%);
    opacity: 0.7;
}

.prize-list {
    /* JS会控制transform */
    transition: transform 5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.prize-item {
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--highlight-color);
}

/* 抽奖按钮 - 呼吸光晕效果 */
.draw-btn {
    position: relative;
    width: 180px;
    height: 60px;
    background: linear-gradient(45deg, var(--primary-glow), var(--secondary-glow));
    border: none;
    border-radius: 30px;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    outline: none;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 20px var(--primary-glow), 0 0 30px var(--secondary-glow);
    animation: breath 3s infinite ease-in-out;
}

.draw-btn:hover {
    transform: scale(1.05);
}

.draw-btn:active {
    transform: scale(0.95);
}

.draw-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    animation: none;
}

@keyframes breath {
    0%, 100% { box-shadow: 0 0 20px var(--primary-glow), 0 0 30px var(--secondary-glow); }
    50% { box-shadow: 0 0 30px var(--primary-glow), 0 0 45px var(--secondary-glow); }
}

.rules {
    margin-top: 20px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

/* 中奖弹窗 */
.modal {
    display: none; /* JS控制显示 */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 350px;
    padding: 30px;
    text-align: center;
    background: linear-gradient(135deg, #3a2b70, #1a143a);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 40px rgba(169, 114, 255, 0.5);
    transform: scale(0.8);
    animation: popIn 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-content h2 {
    font-size: 1.8rem;
    color: var(--highlight-color);
    margin-bottom: 15px;
    text-shadow: 0 0 10px var(--secondary-glow);
}

.result-prize {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-glow);
    margin: 20px 0;
}

.result-tip {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 25px;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--highlight-color);
}

.confirm-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, var(--primary-glow), var(--secondary-glow));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

.confirm-btn:hover {
    opacity: 0.9;
}

/* 抽奖历史按钮 */
.history-btn {
    position: relative;
    width: 180px;
    height: 50px;
    background: linear-gradient(45deg, #ff9800, #f57c00);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    outline: none;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.5);
    margin-top: 15px;
}

.history-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.7);
}

.history-btn:active {
    transform: scale(0.95);
}

/* 抽奖历史弹窗样式 */
.history-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.history-time {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}

.history-code {
    font-size: 1rem;
    color: var(--primary-glow);
    font-weight: 600;
    margin-bottom: 5px;
    font-family: 'Courier New', monospace;
}

.history-prize {
    font-size: 1.1rem;
    color: var(--highlight-color);
    font-weight: 700;
    text-shadow: 0 0 5px var(--secondary-glow);
}

.no-history {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    padding: 40px 20px;
}

.clear-history-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #f44336, #d32f2f);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 20px;
}

.clear-history-btn:hover {
    opacity: 0.9;
}

/* 获取抽奖机会按钮 */
.get-chance-btn {
    position: relative;
    width: 180px;
    height: 50px;
    background: linear-gradient(45deg, #4CAF50, #45a049);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    outline: none;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
    margin-top: 15px;
}

.get-chance-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.7);
}

.get-chance-btn:active {
    transform: scale(0.95);
}

/* 抽奖次数信息 */
.chance-info {
    font-size: 0.9rem;
    color: var(--primary-glow);
    margin-top: 10px;
    text-shadow: 0 0 5px var(--primary-glow);
}

/* 激活码输入弹窗样式 */
.input-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

#code-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

#code-input:focus {
    border-color: var(--primary-glow);
    box-shadow: 0 0 10px rgba(169, 114, 255, 0.3);
}

#code-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.verify-btn {
    padding: 12px 20px;
    background: linear-gradient(45deg, var(--primary-glow), var(--secondary-glow));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.verify-btn:hover {
    opacity: 0.9;
}

.verify-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 验证结果显示 */
.code-result {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.code-result.success {
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.code-result.error {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}