/* ========== CSS 变量（浅色默认） ========== */
:root {
    --body-bg-start: #0f0f1a;
    --body-bg-grad: radial-gradient(ellipse at 20% 20%, rgba(90,90,180,0.15) 0%, transparent 60%),
                     radial-gradient(ellipse at 80% 80%, rgba(60,60,140,0.1) 0%, transparent 60%),
                     radial-gradient(ellipse at 50% 50%, rgba(40,40,80,0.2) 0%, transparent 70%);
    --card-bg: #ffffff;
    --card-border: #e8e8ee;
    --card-shadow: 0 4px 24px rgba(0,0,0,0.25), 0 1px 4px rgba(0,0,0,0.12);
    --text-primary: #1a1a2e;
    --text-secondary: #888;
    --accent: #5b5fe0;
    --accent-light: rgba(91,95,224,0.08);
    --btn-bg: #1a1a2e;
    --btn-color: #ffffff;
    --btn-shadow: 0 3px 12px rgba(26,26,46,0.3);
    --btn-hover-bg: #232342;
    --btn-hover-shadow: 0 8px 24px rgba(26,26,46,0.4);
    --draw-bg: #5b5fe0;
    --draw-hover-bg: #4a4ed0;
    --reset-border: #e04545;
    --reset-color: #e04545;
    --input-bg: #fafafc;
    --input-border: #e0e0e8;
    --result-bg: #fafafc;
    --result-border: #d8d8e4;
    --result-border-active: #c5c5d8;
    --result-bg-active: #fdfdfe;
    --name-bg: #1a1a2e;
    --name-color: white;
    --name-accent-border: #5b5fe0;
    --empty-tip: #aaa;
    --back-btn-bg: #f0f0f5;
    --back-btn-color: #555;
    --back-btn-border: #e0e0e8;
    --back-btn-hover-bg: #e4e4ee;
    --back-btn-hover-color: #333;
    --footer-bg: #1a1a2e;
    --footer-color: rgba(255,255,255,0.9);
}

/* ========== 深色模式覆盖 ========== */
@media (prefers-color-scheme: dark) {
    :root {
        --body-bg-start: #000000;
        --body-bg-grad: radial-gradient(ellipse at 20% 20%, rgba(30,30,80,0.3) 0%, transparent 60%),
                         radial-gradient(ellipse at 80% 80%, rgba(20,20,60,0.2) 0%, transparent 60%),
                         radial-gradient(ellipse at 50% 50%, rgba(10,10,30,0.5) 0%, transparent 70%);
        --card-bg: #1e1e2e;
        --card-border: #2e2e3e;
        --card-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 1px 4px rgba(0,0,0,0.3);
        --text-primary: #e0e0e0;
        --text-secondary: #aaa;
        --accent: #7b7fe0;
        --accent-light: rgba(123,127,224,0.12);
        --btn-bg: #3a3a5a;
        --btn-color: #fff;
        --btn-shadow: 0 3px 12px rgba(0,0,0,0.5);
        --btn-hover-bg: #4a4a6a;
        --btn-hover-shadow: 0 8px 24px rgba(0,0,0,0.6);
        --draw-bg: #7b7fe0;
        --draw-hover-bg: #6a6ed0;
        --reset-border: #ff6b6b;
        --reset-color: #ff6b6b;
        --input-bg: #2a2a3c;
        --input-border: #3a3a4e;
        --result-bg: #2a2a3c;
        --result-border: #3a3a4e;
        --result-border-active: #4a4a5e;
        --result-bg-active: #303040;
        --name-bg: #3a3a5a;
        --name-color: white;
        --name-accent-border: #7b7fe0;
        --empty-tip: #888;
        --back-btn-bg: #2a2a3c;
        --back-btn-color: #ccc;
        --back-btn-border: #3a3a4e;
        --back-btn-hover-bg: #3a3a4e;
        --back-btn-hover-color: #fff;
        --footer-bg: #10101e;
        --footer-color: rgba(255,255,255,0.7);
    }
}

/* ========== 基础重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
}

body {
    min-height: 100vh;
    background-color: var(--body-bg-start);
    background-image: var(--body-bg-grad);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    letter-spacing: 0.02em;
    padding-bottom: 70px; /* 避免内容被固定 footer 遮挡 */
}

/* ========== 主页面卡片 ========== */
.main-container {
    background: var(--card-bg);
    padding: 55px 50px;
    border-radius: 0;
    text-align: center;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    max-width: 520px;
    width: 100%;
}

.main-title {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: 0.04em;
}

.main-container::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--accent);
    margin: 12px auto 32px;
}

/* ========== 班级选择按钮 ========== */
.class-btn {
    padding: 16px 44px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 0;
    margin: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    background: var(--btn-bg);
    color: var(--btn-color);
    box-shadow: var(--btn-shadow);
    letter-spacing: 0.05em;
    position: relative;
    min-width: 160px;
}

.class-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    background: var(--accent);
    transition: height 0.25s ease;
}

.class-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--btn-hover-shadow);
    background: var(--btn-hover-bg);
}
.class-btn:hover::after {
    height: 3px;
}

.class-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(26, 26, 46, 0.35); /* 保留质感，可不变 */
}

/* ========== 班级页面容器 ========== */
.container {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    border-radius: 0;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    padding: 35px 30px 30px;
    text-align: center;
    display: none;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
}

.title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.03em;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 14px;
    letter-spacing: 0.03em;
}

/* ========== 返回按钮 ========== */
.back-btn {
    background: var(--back-btn-bg);
    color: var(--back-btn-color);
    margin-bottom: 22px;
    border-radius: 0;
    border: 1px solid var(--back-btn-border);
    box-shadow: none;
    font-weight: 500;
    letter-spacing: 0.04em;
    transition: all 0.25s ease;
}
.back-btn:hover {
    background: var(--back-btn-hover-bg);
    color: var(--back-btn-hover-color);
    border-color: #ccc; /* 可替换为变量 */
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========== 输入组 ========== */
.input-group {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

#countInput1,
#countInput2 {
    width: 120px;
    padding: 13px 16px;
    border: 2px solid var(--input-border);
    border-radius: 0;
    font-size: 16px;
    outline: none;
    transition: all 0.25s ease;
    background: var(--input-bg);
    letter-spacing: 0.03em;
    font-weight: 500;
    color: var(--text-primary);
}

#countInput1:focus,
#countInput2:focus {
    border-color: var(--accent);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ========== 通用按钮样式 ========== */
.btn {
    padding: 13px 26px;
    border: none;
    border-radius: 0;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.04em;
}

/* 抽取按钮 */
.draw-btn {
    background: var(--draw-bg);
    color: white;
    box-shadow: 0 3px 10px rgba(91, 95, 224, 0.3);
}

.draw-btn:hover {
    background: var(--draw-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(91, 95, 224, 0.4);
}
.draw-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(91, 95, 224, 0.3);
}

/* 重置按钮 */
.reset-btn {
    background: transparent;
    color: var(--reset-color);
    border: 2px solid var(--reset-border);
    box-shadow: none;
    font-weight: 600;
}

.reset-btn:hover {
    background: var(--reset-color);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(224, 69, 69, 0.3);
}
.reset-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(224, 69, 69, 0.25);
}

/* ========== 结果显示区域 ========== */
.result-area {
    margin-top: 30px;
    min-height: 150px;
    padding: 24px 20px;
    border: 2px dashed var(--result-border);
    border-radius: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 14px;
    background: var(--result-bg);
    transition: border-color 0.3s ease;
}

.result-area:has(.name-item) {
    border-color: var(--result-border-active);
    background: var(--result-bg-active);
}

.name-item {
    background: var(--name-bg);
    color: var(--name-color);
    padding: 13px 22px;
    border-radius: 0;
    font-size: 17px;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(26, 26, 46, 0.25);
    animation: fadeIn 0.45s ease forwards;
    opacity: 0;
    letter-spacing: 0.04em;
    position: relative;
    border-left: 3px solid var(--name-accent-border);
}

.empty-tip {
    color: var(--empty-tip);
    font-size: 15px;
    letter-spacing: 0.03em;
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.6) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.name-item:nth-child(1) { animation-delay: 0.05s; }
.name-item:nth-child(2) { animation-delay: 0.15s; }
.name-item:nth-child(3) { animation-delay: 0.25s; }
.name-item:nth-child(4) { animation-delay: 0.35s; }
.name-item:nth-child(5) { animation-delay: 0.45s; }
.name-item:nth-child(n+6) { animation-delay: 0.55s; }

/* ========== 粘性底部 ========== */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--footer-bg);
    color: var(--footer-color);
    text-align: center;
    padding: 10px 0 14px;
    z-index: 10;
    letter-spacing: 0.04em;
}

.footer-line-large {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.4;
}

.footer-line-small {
    font-size: 12px;
    opacity: 0.65;
    line-height: 1.4;
}

/* ========== 响应式适配 ========== */
@media (max-width: 500px) {
    .main-container {
        padding: 35px 20px;
    }
    .class-btn {
        padding: 14px 28px;
        font-size: 16px;
        min-width: 130px;
        margin: 8px;
    }
    .container {
        padding: 28px 16px 20px;
    }
    .btn {
        padding: 11px 18px;
        font-size: 14px;
    }
    .name-item {
        padding: 10px 16px;
        font-size: 15px;
    }
    .main-title {
        font-size: 24px;
    }
}

.footer-line-large {
    font-size: 8px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.4;
}

.footer-line-small {
    font-size: 8px;
    opacity: 0.30;
    line-height: 1.4;
}

/* 避免页面内容被底部栏遮挡 */
body {
    padding-bottom: 50px;  /* 高度略大于 footer 实际高度 */
}
