/* 将HTML中的<style>标签内容移到这里 */
body, html {
    width: 100%;
    height: 100%;
    background: transparent; /* 移除背景色 */
    position: relative;
    overflow: hidden;
}

/* 添加星星效果 */
.star {
    position: fixed;
    width: 2px;
    height: 2px;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle 3s infinite;
}

/* 添加流星效果 */
.shooting-star {
    position: fixed;
    width: 100px;
    height: 1px;
    background: linear-gradient(90deg, #fff, transparent);
    opacity: 0;
    animation: shoot 3s linear infinite;
    transform: rotate(-45deg);
}

/* 雪花粒子效果 */
.snow-particle {
    position: fixed;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    pointer-events: none;
    animation: emit-particle 2s ease-out forwards;
}

/* 星星闪烁动画 */
@keyframes twinkle {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* 流星动画 */
@keyframes shoot {
    0% {
        transform: translateX(-100%) translateY(0) rotate(-45deg);
        opacity: 1;
    }
    100% {
        transform: translateX(200%) translateY(-200%) rotate(-45deg);
        opacity: 0;
    }
}

/* 雪花发射动画 */
@keyframes emit-particle {
    0% {
        transform: translate(-50%, -50%) scale(0.1);
        opacity: 1;
    }
    100% {
        transform: translate(
            calc(var(--tx) * 100px),
            calc(var(--ty) * 100px)
        ) scale(0);
        opacity: 0;
    }
}

/* 修改结果显示样式 */
.result {
    position: fixed;
    width: 90%;
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    padding: 20px;
    display: none;
    z-index: 1000;
    max-height: 80vh;
    overflow-y: auto;
}

.result span {
    display: inline-block;
    font-size: var(--result-font-size, min(48px, calc(24px + 1.5vw)));
    min-width: var(--result-min-width, 180px);
    background: linear-gradient(135deg, #45aaf2, #2d98da);  /* 改为蓝色系 */
    color: white;  /* 改为白色文字 */
    text-shadow: 1.5px 1.5px 3px rgba(0, 0, 0, 0.3);
    margin: var(--result-margin, 15px);
    padding: var(--result-padding, 22px 38px);
    border-radius: 22px;
    box-shadow: 
        0 5px 15px rgba(255, 0, 0, 0.3),
        inset 0 0 10px rgba(255, 215, 0, 0.2);
    animation: resultPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    border: 3px solid #fff;
    opacity: 0;
    transform: scale(0.5);
    flex: 0 1 auto;
    word-break: keep-all;
    white-space: nowrap;
}

/* 不同数量级的样式调整 */
.result[data-count="1"] span {
    --result-font-size: 72px;
    --result-min-width: 240px;
    --result-padding: 38px 60px;
    --result-margin: 22px;
}

.result[data-count="2"] span {
    --result-font-size: 63px;
    --result-min-width: 225px;
    --result-padding: 30px 52px;
    --result-margin: 18px;
}

.result[data-count="3"] span {
    --result-font-size: 54px;
    --result-min-width: 210px;
    --result-padding: 27px 45px;
    --result-margin: 18px;
}

.result[data-count="4"] span {
    --result-font-size: 48px;
    --result-min-width: 195px;
    --result-padding: 22px 38px;
    --result-margin: 15px;
}

.result[data-count="5"] span {
    --result-font-size: 42px;
    --result-min-width: 180px;
    --result-padding: 18px 30px;
    --result-margin: 15px;
}

/* 6-10人 */
.result[data-count="10"] span {
    --result-font-size: 36px;
    --result-min-width: 165px;
    --result-padding: 15px 27px;
    --result-margin: 12px;
}

/* 11-20人 */
.result[data-count="20"] span {
    --result-font-size: 30px;
    --result-min-width: 150px;
    --result-padding: 12px 22px;
    --result-margin: 9px;
}

/* 21-50人 */
.result[data-count="50"] span {
    --result-font-size: 27px;
    --result-min-width: 135px;
    --result-padding: 9px 18px;
    --result-margin: 8px;
}

/* 50人以上 */
.result[data-count="100"] span {
    --result-font-size: 24px;
    --result-min-width: 120px;
    --result-padding: 8px 15px;
    --result-margin: 6px;
}

/* 100人以上 */
.result[data-count="more"] span {
    --result-font-size: 21px;
    --result-min-width: 105px;
    --result-padding: 6px 12px;
    --result-margin: 5px;
}

.result-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    max-height: 70vh; /* 限制最大高度 */
    overflow-y: auto; /* 添加垂直滚动 */
}

/* 添加弹出动画 */
@keyframes resultPop {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }
    70% {
        opacity: 1;
        transform: scale(1.1) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 为多个结果添加延迟动画 */
.result span:nth-child(2) { animation-delay: 0.1s; }
.result span:nth-child(3) { animation-delay: 0.2s; }
.result span:nth-child(4) { animation-delay: 0.3s; }
.result span:nth-child(5) { animation-delay: 0.4s; }

/* 添加光晕效果 */
.result span::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #FFD700, transparent, #FFD700);
    border-radius: 15px;
    z-index: -1;
    animation: glowingBorder 2s linear infinite;
    opacity: 0.5;
}

@keyframes glowingBorder {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

button, input, optgroup, select, textarea {
    color: inherit;
    font: inherit;
    margin: 0;
    border: none;
}

button {
    overflow: visible;
}

button, select {
    text-transform: none;
}

button, html input[type=button], input[type=reset], input[type=submit] {
    -webkit-appearance: button;
    cursor: pointer;
}

.tools {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 1000;
    width: auto;
    min-width: 80%;  /* 添加最小宽度 */
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;  /* 防止按钮换行 */
}

/* 统一按钮样式 */
.tools .pure-button {
    display: inline-block;
    margin: 0 5px;
    padding: 10px 15px;  /* 减小左右内边距 */
    min-width: 40px;    /* 减小最小宽度 */
    font-size: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    color: #ffffff;
    font-weight: bold;
    transition: all 0.3s ease;
    background: rgba(75, 101, 132, 0.5);
    white-space: nowrap;  /* 防止文字换行 */
}

/* 按钮悬停效果 */
.tools .pure-button:hover {
    background: rgba(75, 101, 132, 0.7);  /* 悬停时加深 */
    transform: translateY(-1px);
}

/* 按钮点击效果 */
.tools .pure-button:active {
    transform: translateY(1px);
}

.mask {
    -webkit-filter: blur(5px);
    filter: blur(5px);
}

#main {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 1s;
    z-index: 1; /* 确保在星空之上 */
}

#myCanvas {
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    width: min(96vh, 96vw);    /* 从93%增加到96% */
    height: min(96vh, 96vw);   /* 保持正方形 */
}

.result-btn {
    margin-top: 20px;
    text-align: right;
    margin-right: 30px;
    text-decoration: none;
    color: white;
}

/* 输入组样式 */
.input-group {
    display: flex;
    align-items: center;
    margin: 0 10px;
    background: rgba(75, 101, 132, 0.3);  /* 与按钮颜色统一 */
    padding: 0 15px;
    border-radius: 8px;
    height: 42px;
}

/* 输入组内的按钮 */
.input-group .pure-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    margin: 0 2px;
    border-radius: 6px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-group label {
    color: white;
    margin-right: 10px;
    font-size: 16px;
    font-weight: bold;
    display: inline-block;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}

.number-input {
    width: 30px;
    text-align: center;
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: bold;
    margin: 0 5px;
    padding: 0;
}

/* 恢复点名记录页面样式 */
.winner-list {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px 0;
}

.winner-list-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-top: 5vh;
}

.winner-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.winner-list-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
}

.winner-list-body {
    padding: 15px 20px;
    overflow-y: auto;
}

.winner-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    font-size: 16px;
}

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

.winner-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.winner-time {
    font-size: 14px;
    color: #888;
}

/* 导出和清除按钮样式 */
.winner-list-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    position: sticky;
    bottom: 0;
}

.winner-list-actions button {
    padding: 8px 15px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.export-btn {
    background-color: #4CAF50;
    color: white;
}

.clear-btn {
    background-color: #f44336;
    color: white;
}

/* 添加班级管理相关样式 */
.class-management {
    margin-bottom: 20px;
}

.class-select {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.class-select select {
    flex: 1;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.class-name-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    margin-bottom: 20px;
    background: #fff;
}

.class-name-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76,175,80,0.3);
}

/* 调整按钮样式 */
.class-select .pure-button {
    padding: 8px 15px;
    font-size: 14px;
}

/* 调整弹窗内容的样式 */
.winner-list-content {
    min-width: 300px;
}

.settings-form {
    padding: 20px 0;
}

/* 添加音频设置样式 */
.audio-settings {
    margin-bottom: 15px;
    padding: 12px;
}

.audio-settings h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

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

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

.setting-item label {
    font-size: 16px;
    color: #555;
}

/* 修复开关按钮样式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    z-index: 1; /* 确保开关在上层 */
}

.toggle-switch input {
    opacity: 0;
    width: 100%; /* 扩大可点击区域 */
    height: 100%;
    position: absolute;
    z-index: 2; /* 确保复选框在最上层 */
    cursor: pointer;
    margin: 0;
    left: 0;
    top: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
    z-index: 0; /* 确保滑块在下层 */
}

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

input:checked + .toggle-slider {
    background-color: #4CAF50;
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px #4CAF50;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* 恢复抽取结果标题样式 */
.prize-title {
    position: relative;
    color: white;
    font-size: 54px;
    text-align: center;
    margin-bottom: 45px;
    font-weight: bold;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.prize-title::before,
.prize-title::after {
    content: '';
    display: block;
    height: 1.5px;
    width: 180px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0));
    margin: 0 30px;
}

/* 设置页面样式 */
.settings-body {
    padding: 20px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.class-management {
    margin-bottom: 20px;
}

.class-select {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.class-select select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background-color: #fff;
}

#nameList {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    resize: vertical;
}

.audio-settings {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

.audio-settings h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

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

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

.setting-item label {
    font-size: 16px;
    color: #555;
}

.settings-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.settings-buttons button {
    min-width: 100px;
}

/* 添加班级模态框样式 */
#add-class-modal .winner-list-content {
    max-width: 500px;
}

.add-class-form {
    padding: 20px;
}

.add-class-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.add-class-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 音乐控制按钮样式 */
.music-control {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(75, 101, 132, 0.7);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.music-control:hover {
    transform: scale(1.1);
    background: rgba(75, 101, 132, 0.9);
}

.music-icon {
    width: 24px;
    height: 24px;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="white" d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/></svg>');
    background-size: cover;
    transition: all 0.5s ease;
}

.music-icon.paused {
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="white" d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/><path fill="white" d="M19 11h-8v2h8v-2z"/></svg>');
}

.music-icon.rotating {
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
} 