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

:root {
    --primary-red: #e53935;
    --dark-red: #c62828;
    --gold: #ffd700;
    --gold-light: #ffed4e;
    --gold-dark: #ffa000;
    --bg-gradient-start: #1a1a2e;
    --bg-gradient-end: #16213e;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 50%, #0f0f23 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: #fff;
}

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

.lantern {
    position: absolute;
    font-size: 3rem;
    animation: swing 3s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}

.lantern-1 { top: 5%; left: 5%; animation-delay: 0s; }
.lantern-2 { top: 5%; right: 5%; animation-delay: 0.5s; }
.lantern-3 { top: 40%; left: 2%; animation-delay: 1s; font-size: 2rem; }
.lantern-4 { top: 40%; right: 2%; animation-delay: 1.5s; font-size: 2rem; }

@keyframes swing {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.firework {
    position: absolute;
    font-size: 2rem;
    animation: sparkle 2s ease-in-out infinite;
}

.firework-1 { top: 15%; left: 15%; animation-delay: 0s; }
.firework-2 { top: 20%; right: 20%; animation-delay: 0.7s; }
.firework-3 { bottom: 30%; left: 20%; animation-delay: 1.4s; }

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

/* ==================== 页面容器 ==================== */
.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.page.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 900px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    padding: 40px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(255, 215, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ==================== 标题样式 ==================== */
.title-box {
    text-align: center;
    margin-bottom: 30px;
}

.title-box h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 50%, var(--gold-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    margin-bottom: 10px;
    animation: titleGlow 2s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.subtitle {
    color: rgba(255, 215, 0, 0.8);
    font-size: 1.2rem;
    letter-spacing: 2px;
}

/* ==================== 设置页面样式 ==================== */
.setup-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.input-group label,
.rounds-section label {
    display: block;
    color: var(--gold);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.input-group textarea {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 15px;
    color: #fff;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.input-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.input-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-add {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    color: #1a1a2e;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.round-item {
    display: flex;
    gap: 15px;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.round-number {
    color: var(--gold);
    font-weight: bold;
    min-width: 50px;
}

.round-item input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 10px 15px;
    color: #fff;
    font-size: 0.95rem;
}

.round-item input:focus {
    outline: none;
    border-color: var(--gold);
}

.round-item input[type="number"] {
    width: 80px;
    flex: none;
}

.btn-remove {
    background: rgba(229, 57, 53, 0.8);
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: var(--primary-red);
    transform: scale(1.05);
}

.btn-start {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    border: none;
    padding: 18px 50px;
    border-radius: 50px;
    color: #fff;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    margin: 20px auto 0;
    display: block;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(229, 57, 53, 0.4);
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(229, 57, 53, 0.5);
}

.btn-start:active {
    transform: translateY(-1px);
}

/* ==================== 抽奖页面样式 ==================== */
.lottery-header {
    text-align: center;
    margin-bottom: 40px;
}

.lottery-header h2 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.lottery-header p {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 8px 0;
}

.lottery-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
}

.name-roller {
    width: 100%;
    max-width: 500px;
    height: 120px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.6) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--gold);
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.3),
        inset 0 0 30px rgba(255, 215, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.name-roller::before,
.name-roller::after {
    content: '✨';
    position: absolute;
    font-size: 1.5rem;
    animation: sparkle 1.5s ease-in-out infinite;
}

.name-roller::before { left: 20px; }
.name-roller::after { right: 20px; }

.rolling-name {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transition: all 0.1s ease;
}

.rolling-name.rolling {
    animation: rollBlur 0.1s linear;
}

@keyframes rollBlur {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.slot-machine {
    display: flex;
    gap: 20px;
}

.slot {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
    border: 2px solid var(--gold);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    animation: slotPulse 1s ease-in-out infinite;
}

.slot:nth-child(2) { animation-delay: 0.2s; }
.slot:nth-child(3) { animation-delay: 0.4s; }

@keyframes slotPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 25px rgba(255, 215, 0, 0.5); }
}

.btn-draw {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: none;
    padding: 25px 80px;
    border-radius: 60px;
    color: #1a1a2e;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    display: block;
    margin: 0 auto 30px;
    transition: all 0.3s ease;
    box-shadow: 
        0 15px 40px rgba(255, 215, 0, 0.4),
        0 0 60px rgba(255, 215, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-draw::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 60%
    );
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.btn-draw:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        0 20px 50px rgba(255, 215, 0, 0.5),
        0 0 80px rgba(255, 215, 0, 0.3);
}

.btn-draw:active {
    transform: translateY(-2px) scale(0.98);
}

.btn-draw:disabled {
    background: #666;
    cursor: not-allowed;
    box-shadow: none;
    animation: none;
}

.btn-draw:disabled::before {
    display: none;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    padding: 0 20px;
}

/* ==================== 结果弹窗样式 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: -1;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal.show {
    display: flex;
    z-index: 1000;
    opacity: 1;
    pointer-events: auto;
    animation: modalFadeIn 0.5s ease;
}

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

.modal-content {
    background: linear-gradient(135deg, #2a2a4a 0%, #1a1a2e 100%);
    border-radius: 24px;
    border: 3px solid var(--gold);
    box-shadow: 
        0 0 60px rgba(255, 215, 0, 0.3),
        0 25px 50px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.5s ease;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    padding: 25px;
    text-align: center;
    border-bottom: 2px solid var(--gold);
}

.modal-header h2 {
    font-size: 2rem;
    color: var(--gold);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

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

.prize-icon {
    font-size: 5rem;
    margin-bottom: 15px;
    animation: prizeBounce 1s ease infinite;
}

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

#result-prize-name {
    font-size: 1.8rem;
    color: var(--gold);
    margin-bottom: 25px;
}

.winners-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.winner-tag {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: #1a1a2e;
    padding: 12px 25px;
    border-radius: 30px;
    font-size: 1.3rem;
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.3);
    animation: winnerPop 0.5s ease backwards;
}

@keyframes winnerPop {
    0% { 
        opacity: 0;
        transform: scale(0);
    }
    70% {
        transform: scale(1.1);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

.btn-continue {
    background: linear-gradient(135deg, var(--primary-red) 0%, var(--dark-red) 100%);
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 25px;
}

.btn-continue:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(229, 57, 53, 0.4);
}

/* ==================== 最终结果页面样式 ==================== */
.final-header {
    text-align: center;
    margin-bottom: 30px;
}

.final-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.final-results {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    overflow: hidden;
    margin-bottom: 30px;
    max-height: 50vh;
    overflow-y: auto;
}

.results-table-container {
    overflow-x: auto;
}

#final-results-table {
    width: 100%;
    border-collapse: collapse;
}

#final-results-table th {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 215, 0, 0.1) 100%);
    color: var(--gold);
    padding: 15px;
    text-align: left;
    font-weight: bold;
    border-bottom: 2px solid var(--gold);
}

#final-results-table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    color: #fff;
}

#final-results-table tr:hover {
    background: rgba(255, 215, 0, 0.05);
}

#final-results-table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.2);
}

.final-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn-download,
.btn-restart {
    border: none;
    padding: 15px 35px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: #1a1a2e;
}

.btn-restart {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: #fff;
}

.btn-download:hover,
.btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ==================== 音乐控制 ==================== */
.music-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
}

.music-control:hover {
    background: rgba(255, 215, 0, 0.4);
    transform: scale(1.1);
}

.music-control.playing {
    animation: musicPulse 1s ease-in-out infinite;
}

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

#music-icon {
    font-size: 1.5rem;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 25px;
    }
    
    .title-box h1,
    .final-header h1 {
        font-size: 2rem;
    }
    
    .lottery-header h2 {
        font-size: 1.8rem;
    }
    
    .rolling-name {
        font-size: 1.8rem;
    }
    
    .btn-draw {
        padding: 20px 50px;
        font-size: 1.4rem;
    }
    
    .round-item {
        flex-wrap: wrap;
    }
    
    .round-item input {
        width: 100%;
    }
    
    .round-item input[type="number"] {
        width: calc(50% - 30px);
    }
}

/* ==================== 滚动条样式 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-light);
}
