/* ============================================================
   英语词汇量自适应测试系统 - 自定义样式
   配合 Tailwind CSS 使用，补充动画与细节效果
   ============================================================ */

/* ---------- 基础 ---------- */
:root {
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --accent-500: #10b981;
    --accent-600: #059669;
    --rose-500: #f43f5e;
    --amber-500: #f59e0b;
}

html { scroll-behavior: smooth; }

body {
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 英文词汇用衬线字体，更具学术质感 */
.font-word {
    font-family: "Fraunces", "Lora", Georgia, serif;
    font-optical-sizing: auto;
}

/* ---------- 渐变背景 ---------- */
.bg-mesh {
    background-color: #f8fafc;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 98% 2%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 98%, rgba(56, 189, 248, 0.10) 0px, transparent 50%);
}

.bg-hero {
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.92) 0%, rgba(99, 102, 241, 0.88) 45%, rgba(16, 185, 129, 0.85) 100%),
        radial-gradient(at 20% 20%, rgba(255, 255, 255, 0.18) 0px, transparent 40%);
}

/* ---------- 卡片 ---------- */
.card {
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 24px -8px rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.card-hover {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 16px 36px -10px rgba(79, 70, 229, 0.22);
}

/* ---------- 进度条 ---------- */
.progress-track {
    background: #eef2ff;
    border-radius: 999px;
    overflow: hidden;
    height: 0.7rem;
}
.progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6366f1 0%, #10b981 100%);
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}
.progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    animation: shimmer 1.8s infinite;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* θ 能力值小进度条 */
.theta-track {
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    height: 0.55rem;
}
.theta-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #f59e0b 0%, #6366f1 50%, #10b981 100%);
    transition: width 0.6s ease;
}

/* ---------- 选项按钮 ---------- */
.option-btn {
    width: 100%;
    text-align: left;
    padding: 1rem 1.25rem;
    border-radius: 0.9rem;
    border: 2px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    font-size: 1.02rem;
    line-height: 1.5;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
@media (hover: hover) {
    .option-btn:hover:not(:disabled) {
        border-color: var(--brand-500);
        background: var(--brand-50);
        transform: translateX(4px);
    }
}
.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}
.option-btn .opt-tag {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
@media (hover: hover) {
    .option-btn:hover:not(:disabled) .opt-tag {
        background: var(--brand-500);
        color: #fff;
    }
}

/* 选中态 */
.option-btn.selected {
    border-color: var(--brand-600);
    background: var(--brand-50);
}
.option-btn.selected .opt-tag {
    background: var(--brand-600);
    color: #fff;
}

/* 正确 / 错误反馈 */
.option-btn.correct {
    border-color: var(--accent-500);
    background: #ecfdf5;
    color: #065f46;
}
.option-btn.correct .opt-tag {
    background: var(--accent-500);
    color: #fff;
}
.option-btn.wrong {
    border-color: var(--rose-500);
    background: #fff1f2;
    color: #9f1239;
}
.option-btn.wrong .opt-tag {
    background: var(--rose-500);
    color: #fff;
}

/* 闪烁动画 */
.flash-correct {
    animation: flashCorrect 0.6s ease;
}
.flash-wrong {
    animation: flashWrong 0.6s ease;
}
@keyframes flashCorrect {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
    50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.35); }
}
@keyframes flashWrong {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
    50% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0.35); }
}

/* ---------- 听力播放按钮 ---------- */
.play-btn {
    width: 5rem;
    height: 5rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #6366f1, #10b981);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 12px 28px -8px rgba(79, 70, 229, 0.5);
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
}
@media (hover: hover) {
    .play-btn:hover:not(:disabled) { transform: scale(1.06); }
}
.play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #94a3b8;
    box-shadow: none;
}
/* 播放时的脉冲圈 */
.play-btn.playing::before,
.play-btn.playing::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    border: 2px solid rgba(99, 102, 241, 0.5);
    animation: pulseRing 1.4s ease-out infinite;
}
.play-btn.playing::after { animation-delay: 0.7s; }
@keyframes pulseRing {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* ---------- 等级标签 ---------- */
.level-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.level-L1, .level-L2 { background: #dcfce7; color: #166534; }
.level-L3, .level-L4 { background: #fef3c7; color: #92400e; }
.level-L5, .level-L6 { background: #fee2e2; color: #991b1b; }

/* ---------- 统计卡片渐变 ---------- */
.stat-card {
    border-radius: 1.25rem;
    padding: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    right: -1.5rem;
    top: -1.5rem;
    width: 6rem;
    height: 6rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.15);
}
.stat-1 { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.stat-2 { background: linear-gradient(135deg, #10b981, #059669); }
.stat-3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-4 { background: linear-gradient(135deg, #ec4899, #db2777); }

/* ---------- 入场动画 ---------- */
.fade-in-up {
    animation: fadeInUp 0.5s ease both;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.12s; }
.stagger-3 { animation-delay: 0.19s; }
.stagger-4 { animation-delay: 0.26s; }

/* ---------- 加载遮罩 ---------- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.spinner {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    border: 4px solid #e0e7ff;
    border-top-color: #4f46e5;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast 提示 ---------- */
.toast {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    padding: 0.85rem 1.5rem;
    border-radius: 0.75rem;
    color: #fff;
    font-size: 0.95rem;
    z-index: 100;
    box-shadow: 0 12px 30px -8px rgba(15, 23, 42, 0.3);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.toast.success { background: linear-gradient(135deg, #10b981, #059669); }
.toast.info { background: linear-gradient(135deg, #6366f1, #4f46e5); }

/* ---------- 表格 ---------- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}
.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}
.data-table tbody tr:hover { background: #f8fafc; }

/* ---------- 分页按钮 ---------- */
.page-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.55rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}
.page-btn:hover:not(:disabled) { border-color: #6366f1; color: #4f46e5; }
.page-btn.active { background: #4f46e5; color: #fff; border-color: #4f46e5; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #a5b4fc; }
