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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 20px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 顶部横幅 */
.header-banner {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: 15px;
    padding: 25px 20px;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(238, 90, 36, 0.3);
}

.header-banner::before {
    content: '🎈';
    position: absolute;
    font-size: 2em;
    top: 10px;
    left: 10px;
    opacity: 0.3;
}

.header-banner::after {
    content: '🎉';
    position: absolute;
    font-size: 2em;
    top: 10px;
    right: 10px;
    opacity: 0.3;
}

.class-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.95);
    color: #ee5a24;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    letter-spacing: 2px;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 10px;
    font-size: 2.2em;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.welcome-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
    margin-top: 5px;
}

.game-info {
    display: flex;
    justify-content: space-around;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
    color: white;
    font-weight: bold;
    font-size: 1em;
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.3);
}

.balance, .multiplier {
    text-align: center;
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-info .icon {
    font-size: 1.3em;
}

.game-info .label {
    font-size: 0.95em;
    opacity: 0.9;
}

#balance, #currentMultiplier {
    font-size: 1.5em;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: bold;
}

.game-info .unit {
    font-size: 1.1em;
    opacity: 0.85;
}

.final-amount-display {
    text-align: center;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: highlightPulse 0.8s ease-in-out infinite;
}

.current-student-display {
    text-align: center;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    padding: 10px 15px;
    border-radius: 8px;
    animation: studentGlow 2s ease-in-out infinite;
}

@keyframes studentGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(116, 185, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(116, 185, 255, 0.8);
    }
}

.current-student-display .icon {
    font-size: 1.3em;
}

.current-student-display .label {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
}

#currentStudentName {
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

@keyframes highlightPulse {
    0%, 100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.3);
    }
    50% {
        transform: scale(1.05);
        background: rgba(255, 255, 255, 0.5);
    }
}

.final-amount-display .icon {
    font-size: 1.5em;
}

.final-amount-display .label {
    font-size: 0.95em;
    opacity: 0.9;
}

#finalAmountTop {
    font-size: 1.6em;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: bold;
}

.redpacket-section, .pinball-section {
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    position: relative;
    margin-bottom: 15px;
}

.section-header .lucky-star {
    font-size: 1.8em;
    animation: twinkle 1.5s ease-in-out infinite;
}

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

h2 {
    text-align: center;
    color: #555;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.draw-btn {
    display: block;
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
    margin-bottom: 15px;
}

.draw-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.6);
}

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

.draw-result {
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #e74c3c;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pinball-machine {
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    border-radius: 20px;
    padding: 10px;
    margin-bottom: 15px;
    box-shadow: inset 0 5px 20px rgba(0, 0, 0, 0.5);
}

#pinballCanvas {
    display: block;
    margin: 0 auto;
    background: radial-gradient(circle at center, #2d3436 0%, #1a1a2e 100%);
    border-radius: 15px;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
    max-width: 100%;
    height: auto;
}

.launch-btn {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 206, 201, 0.4);
}

.launch-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 206, 201, 0.6);
}

.launch-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    box-shadow: none;
}

.result-section {
    margin-bottom: 20px;
}

#resultMessage {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.instructions {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    border-radius: 15px;
    border-left: 5px solid #667eea;
    position: relative;
    overflow: hidden;
}

.instructions::before {
    content: '🌟';
    position: absolute;
    font-size: 1.5em;
    top: 10px;
    right: 15px;
    opacity: 0.3;
}

.instructions-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.instructions-header h3 {
    color: #667eea;
    margin: 0;
}

.instructions-header .book-icon {
    font-size: 1.5em;
}

.instructions ol {
    margin-left: 20px;
    color: #555;
    line-height: 1.6;
    font-size: 0.9em;
}

.instructions li {
    margin-bottom: 8px;
}

.class-motto {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1em;
    letter-spacing: 1px;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

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

.result-win {
    animation: pulse 0.5s ease-in-out 3;
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(0, 184, 148, 0.4);
}

@keyframes drawAnimation {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(5deg); }
    50% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.draw-animating {
    animation: drawAnimation 0.3s ease-in-out;
}

.result-normal {
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    color: white;
}

.result-transform {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
    animation: pulse 0.5s ease-in-out 2;
}

.final-amount {
    text-align: center;
    font-size: 1.8em;
    font-weight: bold;
    color: #e74c3c;
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 10px;
    border: 3px solid #ff9800;
}

.final-amount .label {
    display: block;
    font-size: 0.7em;
    color: #666;
    margin-bottom: 5px;
}

.final-amount .value {
    font-size: 1.5em;
    color: #e74c3c;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.final-result-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.final-result-header h3 {
    color: #333;
    margin: 0;
}

.final-result-header .celebrate {
    font-size: 2em;
    animation: celebrate 0.6s ease-in-out infinite;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(-5deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

.restart-btn {
    display: block;
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(142, 68, 173, 0.4);
    margin-top: 10px;
}

.restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(142, 68, 173, 0.6);
}

/* 手机端适配 */
@media screen and (max-width: 768px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 15px;
        border-radius: 15px;
    }

    .header-banner {
        padding: 20px 15px;
    }

    .class-badge {
        font-size: 1.1em;
        padding: 6px 15px;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 8px;
    }

    .welcome-text {
        font-size: 1em;
    }

    .game-info {
        padding: 12px;
        font-size: 0.9em;
        flex-wrap: wrap;
        gap: 10px;
    }

    .current-student-display {
        font-size: 0.85em;
        gap: 6px;
        padding: 8px 12px;
    }

    #currentStudentName {
        font-size: 1em;
    }

    .game-info .icon {
        font-size: 1.1em;
    }

    #balance, #currentMultiplier {
        font-size: 1.2em;
    }

    .final-amount-display {
        font-size: 0.85em;
        gap: 6px;
    }

    #finalAmountTop {
        font-size: 1.3em;
    }

    h2 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }

    .section-header .lucky-star {
        font-size: 1.5em;
    }

    .draw-btn {
        padding: 12px;
        font-size: 1em;
    }

    .draw-result {
        font-size: 1.2em;
        min-height: 40px;
    }

    .pinball-machine {
        padding: 5px;
    }

    .launch-btn {
        padding: 10px;
        font-size: 1em;
    }

    #resultMessage {
        padding: 12px;
        font-size: 0.95em;
        min-height: 50px;
    }

    .final-amount {
        font-size: 1.5em;
        padding: 12px;
    }

    .instructions {
        padding: 12px;
    }

    .instructions-header h3 {
        font-size: 1em;
        margin-bottom: 10px;
    }

    .instructions-header .book-icon {
        font-size: 1.2em;
    }

    .instructions ol {
        font-size: 0.85em;
        margin-left: 15px;
    }

    .instructions li {
        margin-bottom: 5px;
    }

    .class-motto {
        font-size: 0.9em;
        padding: 8px;
    }
}

/* 超小屏幕适配 */
@media screen and (max-width: 480px) {
    h1 {
        font-size: 1.3em;
    }

    .game-info {
        flex-direction: column;
        padding: 8px;
    }

    .draw-btn {
        padding: 10px;
        font-size: 0.95em;
    }

    .draw-result {
        font-size: 1em;
    }

    #resultMessage {
        font-size: 0.9em;
    }

    .instructions ol {
        font-size: 0.8em;
    }
}

/* 学生抽取区域 */
.student-section {
    background: linear-gradient(135deg, #a8e6cf 0%, #dcedc1 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.view-students-btn {
    display: block;
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.view-students-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(78, 205, 196, 0.6);
}

/* 弹窗样式 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4em;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2em;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-stats {
    display: flex;
    justify-content: space-around;
    padding: 15px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.modal-stat {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.stat-text {
    font-size: 0.9em;
    color: #666;
}

.modal-tabs {
    display: flex;
    background: #f8f9fa;
    padding: 10px 25px 0;
    border-bottom: 2px solid #e0e0e0;
}

.modal-tab {
    padding: 12px 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1em;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-weight: bold;
}

.modal-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.modal-tab:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.student-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 400px;
}

.student-item {
    padding: 12px 10px;
    text-align: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-weight: bold;
    color: #333;
}

.student-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.student-item.drawn {
    background: linear-gradient(135deg, #a8e6cf 0%, #dcedc1 100%);
    border-color: #4ecdc4;
    color: #2d7a6e;
}

.student-item.remaining {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-color: #ff9a56;
    color: #d35400;
}

.modal-footer {
    padding: 15px 25px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
}

.reset-students-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 1em;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.reset-students-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.6);
}

/* 游戏设置区域 */
.settings-section {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.settings-btn {
    display: block;
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #fdcb6e 0%, #f39c12 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(253, 203, 110, 0.4);
}

.settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(253, 203, 110, 0.6);
}

/* 设置弹窗样式 */
.settings-container {
    padding: 20px 25px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-icon {
    font-size: 1.5em;
}

.setting-text {
    font-size: 1.1em;
    color: #333;
    font-weight: bold;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #667eea;
}

input:checked + .slider:before {
    transform: translateX(30px);
}

/* 金额范围输入 */
.amount-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.amount-input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    text-align: center;
    font-weight: bold;
    color: #333;
}

.amount-input:focus {
    outline: none;
    border-color: #667eea;
}

.range-separator {
    font-size: 1.2em;
    color: #666;
    font-weight: bold;
}

/* 难度选择 */
.difficulty-select {
    padding: 8px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    background: white;
}

.difficulty-select:focus {
    outline: none;
    border-color: #667eea;
}

/* 保存设置按钮 */
.save-settings-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 1em;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.save-settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

/* 手机端适配 */
@media screen and (max-width: 768px) {
    .student-section {
        padding: 15px;
    }

    .settings-section {
        padding: 15px;
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-header h3 {
        font-size: 1.2em;
    }

    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 1.5em;
    }

    .modal-stats {
        padding: 10px 15px;
    }

    .stat-number {
        font-size: 1.5em;
    }

    .stat-text {
        font-size: 0.8em;
    }

    .modal-tabs {
        padding: 8px 15px 0;
    }

    .modal-tab {
        padding: 10px 15px;
        font-size: 0.9em;
    }

    .student-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
        padding: 15px;
        max-height: 350px;
    }

    .student-item {
        padding: 10px 5px;
        font-size: 0.85em;
    }

    .modal-footer {
        padding: 12px 15px;
    }

    .reset-students-btn {
        padding: 10px 25px;
        font-size: 0.9em;
    }

    .settings-container {
        padding: 15px;
    }

    .setting-item {
        padding: 12px 0;
    }

    .setting-text {
        font-size: 1em;
    }

    .setting-icon {
        font-size: 1.3em;
    }

    .amount-input {
        width: 60px;
        padding: 6px 8px;
        font-size: 0.9em;
    }

    .difficulty-select {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .save-settings-btn {
        padding: 10px 25px;
        font-size: 0.9em;
    }
}

@media screen and (max-width: 480px) {
    .student-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
        padding: 10px;
    }

    .student-item {
        padding: 8px 4px;
        font-size: 0.8em;
    }
}
