/* 定义CSS变量，便于主题切换和维护 */
:root {
    --bg-color: linear-gradient(135deg, #f0f4ff 0%, #e6ecff 50%, #d9e2ff 100%); /* 渐变背景色 */
    --card-color: linear-gradient(135deg, #ffffff 0%, #f8faff 100%); /* 渐变卡片色 */
    --primary-color: #4a90e2; /* 明亮的蓝色主色 */
    --neon-color: #ff6b6b; /* 明亮的红色霓虹色 */
    --text-color: #2c3e50; /* 深蓝色文字 */
    --placeholder-color: #7f8c8d;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center; /* 垂直水平居中 */
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

/* 响应式容器 */
.container {
    width: 100%;
    max-width: 800px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    color: var(--primary-color); /* 使用主色调 */
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.3), 0 0 20px rgba(74, 144, 226, 0.2);
    margin-bottom: 5px;
}

.header p {
    color: var(--neon-color);
    font-style: italic;
}

/* --- 配置区域样式 --- */
.controls-card {
    background: var(--card-color);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 0 30px rgba(74, 144, 226, 0.1) inset;
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
}

.control-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.control-group label {
    flex-shrink: 0;
    margin-right: 10px;
    min-width: 100px;
}

.control-group input[type="number"] {
    flex-grow: 1;
    padding: 10px;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
    background: #ffffff;
    color: var(--text-color);
    max-width: 150px;
}

.control-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    accent-color: var(--neon-color); /* 改变复选框颜色 */
}

/* 抽取按钮 - 核心动画元素 */
.draw-button {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), #5ca0ff);
    color: white;
    cursor: pointer;
    box-shadow: 0 0 15px var(--primary-color);
    transition: all 0.3s ease;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.draw-button:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--neon-color), #ff8e8e);
    box-shadow: 0 0 20px var(--neon-color), 0 0 40px var(--neon-color);
    transform: translateY(-2px);
}

.draw-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.draw-button:hover:not(:disabled)::before {
    left: 100%;
}

.draw-button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

/* --- 结果区域样式 --- */
.result-area {
    min-height: 200px;
    background: var(--card-color);
    border-radius: 15px;
    padding: 20px;
    position: relative;
    overflow: hidden; /* 粒子容器在其内部 */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.result-content {
    position: relative;
    z-index: 2; /* 确保结果内容在粒子上方 */
    text-align: center;
    width: 100%;
}

.placeholder-text {
    font-size: 1.2em;
    color: var(--placeholder-color);
    font-style: italic;
}

/* 结果项（单个或多个） */
.result-name-item {
    margin: 10px;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 2em;
    font-weight: bold;
    display: inline-block; /* 允许多个并排 */
    /* 默认样式，等待动画 */
    background: #f0f4ff;
    color: var(--text-color);
    opacity: 0;
    transform: scale(0.5);
    transition: all 1.0s cubic-bezier(0.68, -0.55, 0.265, 1.55); /* 弹性动画 - 时间加倍 */
}

/* 单个抽取结果的动画和样式 */
.result-name-item.single-result {
    font-size: 3.5em; /* 强调单次结果 */
    background: linear-gradient(135deg, #4a90e2, #5ca0ff);
    color: white;
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
    border: 2px solid #4a90e2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 多个抽取结果的样式 */
.result-name-item.multi-result {
    font-size: 1.8em;
    background: linear-gradient(135deg, #ffffff, #f8faff);
    color: #2c3e50;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid #e0e8ff;
    transition: all 0.3s ease;
}

/* 多结果悬停效果 */
.result-name-item.multi-result:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 抽取成功后的显示动画（通用于单个和多个） */
.result-name-item.show {
    opacity: 1;
    transform: scale(1);
}

/* 抽取中的旋转/闪烁动画 */
@keyframes spin-flash {
    0% { transform: scale(1.1) rotate(0deg); opacity: 0.8; }
    50% { transform: scale(0.9) rotate(180deg); opacity: 1; }
    100% { transform: scale(1.1) rotate(360deg); opacity: 0.8; }
}

.result-name-item.drawing {
    animation: spin-flash 0.5s infinite alternate;
}

/* --- 粒子动画容器 --- */
.particle-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none; /* 确保不影响点击 */
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: var(--neon-color);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--neon-color), 0 0 10px var(--neon-color);
    opacity: 0; /* 默认隐藏 */
}

/* --- 消息提示区域 --- */
.message-area {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
}
.message-area.error {
    background: #ff5555;
    box-shadow: 0 0 10px #ff5555;
}
.hidden { display: none; }

/* --- 小屏幕适配 (小于 600px) --- */
@media (max-width: 600px) {
    .header h1 {
        font-size: 2em;
    }
    .result-name-item {
        font-size: 1.5em; /* 减小多结果字体 */
    }
    .result-name-item.single-result {
        font-size: 2.5em; /* 减小单结果字体 */
    }
    .controls-card {
        padding: 15px;
    }
    .control-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .control-group label {
        margin-bottom: 5px;
    }
    .control-group input[type="number"] {
        max-width: 100%;
    }
}