/* ===== 基础样式 ===== */
:root {
    --primary: #4A90E2;
    --primary-light: #6BA5E7;
    --primary-dark: #3A7BC8;
    --secondary: #50C878;
    --secondary-light: #6FD593;
    --accent: #FF9500;
    --accent-light: #FFB84D;
    --bg: #F5F7FA;
    --surface: #FFFFFF;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --border: #E8ECF0;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 12px;
    --radius: 20px;
    --radius-lg: 28px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg);
    opacity: 0;
    pointer-events: none;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    padding-bottom: 80px;
}

.page.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

/* ===== 按钮样式 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-height: 48px;
    min-width: 48px;
    box-shadow: var(--shadow);
}

.btn:active {
    filter: brightness(0.92);
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    color: white;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
    color: white;
}

.btn-large {
    padding: 24px 40px;
    font-size: 20px;
    border-radius: var(--radius-lg);
    min-height: 80px;
    width: 100%;
    max-width: 100%;
    touch-action: manipulation;
}

.btn-block {
    width: 100%;
}

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

.btn-back {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--surface);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 页面头部 ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.header-spacer {
    width: 44px;
}

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    min-width: 64px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 24px;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* ===== 首页样式 ===== */
.home-container {
    padding: 24px 20px 100px;
    max-width: 600px;
    margin: 0 auto;
}

.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.avatar-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: var(--shadow);
}

.user-info h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.level-badge {
    display: inline-block;
    padding: 2px 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.score-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    padding: 8px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.score-icon {
    font-size: 20px;
}

.score-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

/* 吉祥物欢迎 */
.mascot-welcome {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.mascot {
    width: 60px;
    height: 60px;
    font-size: 40px;
    background: linear-gradient(135deg, #FFE5B4, #FFDAB9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.speech-bubble {
    flex: 1;
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius);
    border-top-left-radius: 4px;
    box-shadow: var(--shadow);
    position: relative;
}

.speech-bubble p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
}

/* 今日状态 */
.today-status {
    background: var(--surface);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.status-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
}

.status-bar {
    width: 100%;
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.status-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--secondary-light));
    border-radius: 6px;
    transition: width 0.5s ease;
}

.status-text {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* 首页按钮 */
.home-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 24px;
    padding: 0 8px;
}

/* 快速统计 */
.quick-stats {
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== 训练中心 ===== */
.training-container {
    padding: 16px 20px 100px;
    max-width: 700px;
    margin: 0 auto;
}

.category-section {
    margin-bottom: 28px;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.category-icon {
    font-size: 22px;
}

.category-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-left: 30px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.level-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.level-card:active {
    transform: scale(0.98);
}

.level-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.level-card.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    opacity: 0.8;
}

.level-card.completed {
    border-left: 4px solid var(--secondary);
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.level-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.level-stars {
    font-size: 14px;
    letter-spacing: 2px;
}

.level-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.level-score {
    color: var(--accent);
    font-weight: 600;
}

.level-passed {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #E8F5E9;
    color: var(--secondary);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
}

/* ===== 训练准备页 ===== */
.prepare-container {
    padding: 20px 20px 120px;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.prepare-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.prepare-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.prepare-desc {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.6;
}

.prepare-rules {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    text-align: left;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.prepare-rules h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--primary);
}

.prepare-rules ul {
    list-style: none;
    padding: 0;
}

.prepare-rules li {
    padding: 8px 0;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.prepare-rules li:last-child {
    border-bottom: none;
}

.prepare-rules li::before {
    content: '✓';
    display: inline-block;
    width: 24px;
    height: 24px;
    background: var(--secondary);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    margin-right: 10px;
    font-size: 12px;
    font-weight: 700;
}

.prepare-target {
    background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}

.prepare-target h3 {
    font-size: 15px;
    color: var(--accent);
    margin-bottom: 8px;
}

.prepare-target p {
    font-size: 14px;
    color: var(--text);
}

/* ===== 训练进行页 ===== */
#page-game {
    padding: 0;
    background: #2C3E50;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}

/* 游戏进行时隐藏底部导航 */
body.game-active .bottom-nav {
    display: none;
}

body.game-active #page-game {
    padding-bottom: 20px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255,255,255,0.1);
    position: relative;
}

.game-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    color: white;
    font-size: 14px;
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

.game-score {
    color: var(--accent);
    font-size: 16px;
    font-weight: 700;
}

.game-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.stimulus {
    font-size: 72px;
    font-weight: 900;
    text-align: center;
    animation: stimulusIn 0.3s ease;
}

@keyframes stimulusIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.stimulus-word {
    font-size: 56px;
    font-weight: 800;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.stimulus-shape {
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-controls {
    padding: 20px 20px 40px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Stroop选项按钮 */
.answer-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0 20px 20px;
}

.answer-btn {
    min-width: 72px;
    min-height: 56px;
    padding: 12px 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 16px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-btn:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.35);
}

.answer-btn.correct {
    background: #50C878;
    border-color: #50C878;
}

.answer-btn.wrong {
    background: #E53935;
    border-color: #E53935;
}

.voice-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.voice-btn:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.3);
}

.game-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.game-btn:active {
    transform: scale(0.92);
}

.game-btn-go {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    color: white;
}

.game-btn-nogo {
    background: linear-gradient(135deg, #95A5A6, #BDC3C7);
    color: white;
}

.game-btn-hint {
    font-size: 12px;
    opacity: 0.9;
}

/* 语音识别指示器 */
.voice-indicator {
    position: absolute;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    padding: 12px 24px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
}

.voice-wave {
    width: 4px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.voice-wave:nth-child(2) { animation-delay: 0.1s; }
.voice-wave:nth-child(3) { animation-delay: 0.2s; }

@keyframes wave {
    0%, 100% { height: 8px; }
    50% { height: 24px; }
}

/* 反馈层 */
.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.feedback-icon {
    font-size: 80px;
    animation: feedbackPop 0.5s ease;
}

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

/* ===== 结果页 ===== */
.result-container {
    padding: 24px 20px 100px;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.result-mascot {
    font-size: 80px;
    margin-bottom: 8px;
}

.result-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.result-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.result-stats {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.result-stat-item {
    text-align: center;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.result-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.result-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.result-passed {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    color: var(--secondary);
    padding: 16px;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
}

.result-failed {
    background: linear-gradient(135deg, #FFEBEE, #FFCDD2);
    color: #E53935;
    padding: 16px;
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 24px;
}

.result-points {
    font-size: 20px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 24px;
}

.result-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.result-buttons .btn {
    flex: 1;
    max-width: 160px;
}

/* ===== 进度页 ===== */
.progress-container {
    padding: 0 0 100px;
}

.tab-bar {
    display: flex;
    background: var(--surface);
    padding: 4px;
    margin: 0 20px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
    padding: 0 20px;
}

.tab-content.active {
    display: block;
}

/* 日历 */
.calendar-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-header button {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
}

.calendar-header span {
    font-size: 16px;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.calendar-grid .day-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    padding: 8px 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 500;
    background: var(--bg);
}

.calendar-day.completed {
    background: var(--primary);
    color: white;
}

.calendar-day.passed {
    background: var(--secondary);
    color: white;
}

.calendar-day.partial {
    background: var(--accent);
    color: white;
}

.calendar-day.today {
    border: 2px solid var(--primary);
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 4px;
}

.legend-dot.completed { background: var(--primary); }
.legend-dot.passed { background: var(--secondary); }
.legend-dot.partial { background: var(--accent); }

/* 图表区域 */
.chart-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.chart-section select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    background: var(--bg);
}

#progress-chart {
    width: 100%;
    height: 250px;
}

/* 徽章墙 */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.badge-item {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 8px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.badge-item.locked {
    opacity: 0.4;
}

.badge-item:not(.locked) {
    border: 2px solid var(--accent);
}

.badge-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.badge-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.badge-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== 设置页 ===== */
.settings-container {
    padding: 16px 20px 100px;
    max-width: 600px;
    margin: 0 auto;
}

.settings-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

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

.setting-item label {
    font-size: 14px;
    color: var(--text);
}

.setting-item input[type="text"] {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    width: 160px;
    text-align: right;
}

.setting-item select {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg);
}

.toggle-item {
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

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

/* ===== 帮助页 ===== */
.help-container {
    padding: 16px 20px 100px;
    max-width: 600px;
    margin: 0 auto;
}

.help-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.help-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--primary);
}

.help-content p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 8px;
}

/* ===== 庆祝动画 ===== */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.celebration-text {
    position: relative;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white;
    animation: celebratePop 0.6s ease;
    z-index: 10;
}

@keyframes celebratePop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ===== 模态框 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.modal-text {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ===== 响应式优化 ===== */
@media (min-width: 768px) {
    .page {
        padding-bottom: 0;
    }
    
    .home-container,
    .training-container,
    .prepare-container,
    .result-container,
    .progress-container,
    .settings-container,
    .help-container {
        max-width: 700px;
    }
    
    .stimulus-word {
        font-size: 72px;
    }
    
    .game-btn {
        width: 140px;
        height: 140px;
        font-size: 20px;
    }
}

@media (min-width: 1024px) {
    .level-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .badges-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 隐藏滚动条 */
.page::-webkit-scrollbar {
    display: none;
}

.page {
    -ms-overflow-style: none;
    scrollbar-width: none;
}


/* ===== 动画关键帧 ===== */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.08); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-12px); }
    30% { transform: translateX(10px); }
    45% { transform: translateX(-8px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== 刺激物动画 ===== */
.stimulus-bounce {
    animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stimulus-float {
    animation: floatY 2s ease-in-out infinite;
}

/* ===== 反馈动画 ===== */
.feedback-pulse {
    animation: pulse 0.5s ease;
}

.feedback-shake {
    animation: shake 0.5s ease;
}

/* ===== 按钮动画 ===== */
.answer-btn-anim {
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.answer-btn-anim:active {
    transform: scale(0.9) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}

.game-btn-anim {
    transition: transform 0.15s, box-shadow 0.15s;
}

.game-btn-anim:active {
    transform: scale(0.92) !important;
}

/* ===== 更鲜明的按钮样式 ===== */
.answer-btn {
    min-width: 76px;
    min-height: 60px;
    padding: 14px 22px;
    border: 3px solid rgba(255,255,255,0.35);
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    color: white;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.answer-btn:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.35), rgba(255,255,255,0.2));
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.answer-btn.correct {
    background: linear-gradient(135deg, #50C878, #2E7D32) !important;
    border-color: #81C784 !important;
    animation: pulse 0.4s ease;
}

.answer-btn.wrong {
    background: linear-gradient(135deg, #E53935, #C62828) !important;
    border-color: #EF5350 !important;
    animation: shake 0.4s ease;
}

/* ===== 游戏按钮增强 ===== */
.game-btn-go {
    background: linear-gradient(135deg, #50C878, #66BB6A) !important;
    box-shadow: 0 8px 24px rgba(80,200,120,0.4) !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

.game-btn-go:active {
    box-shadow: 0 4px 12px rgba(80,200,120,0.3) !important;
}

/* ===== 结果页统计增强 ===== */
.result-stats {
    gap: 12px !important;
}

.result-stat-item {
    border-radius: 16px !important;
    padding: 16px 12px !important;
    background: linear-gradient(135deg, #f8f9fa, #ffffff) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    transition: transform 0.2s;
}

.result-stat-item:hover {
    transform: translateY(-2px);
}

/* ===== 首页按钮增强 ===== */
.home-buttons {
    gap: 14px !important;
}

.btn-large {
    min-height: 68px !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    letter-spacing: 1px !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12) !important;
}

.btn-large:active {
    filter: brightness(0.9) !important;
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.2) !important;
}

/* ===== 关卡卡片增强 ===== */
.level-card {
    border-radius: 20px !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
    border: 2px solid transparent;
}

.level-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}

.level-card:active {
    transform: scale(0.98);
}

.level-card.completed {
    border-left: 5px solid var(--secondary) !important;
}

/* ===== 进度条增强 ===== */
.progress-fill {
    background: linear-gradient(90deg, #FF9500, #FFB84D, #FF9500) !important;
    background-size: 200% 100% !important;
    animation: progressShine 2s linear infinite !important;
}

@keyframes progressShine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== 吉祥物增强 ===== */
.mascot {
    animation: floatY 3s ease-in-out infinite;
}

/* ===== 准备页增强 ===== */
.prepare-icon {
    animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.prepare-rules li {
    font-size: 15px !important;
    line-height: 1.8 !important;
}

/* ===== 反馈层增强 ===== */
.feedback-icon {
    font-size: 100px !important;
    font-weight: 900 !important;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
}


/* ===== 关卡内刺激物出现动画（多种随机） ===== */
@keyframes appear-bounce {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    60% { transform: scale(1.1) rotate(2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes appear-pop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes appear-drop {
    0% { transform: translateY(-80px) scale(0.5); opacity: 0; }
    60% { transform: translateY(8px) scale(1.05); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes appear-zoom {
    0% { transform: scale(0.1); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes appear-spin {
    0% { transform: rotate(-180deg) scale(0.3); opacity: 0; }
    60% { transform: rotate(10deg) scale(1.1); opacity: 1; }
    100% { transform: rotate(0) scale(1); opacity: 1; }
}

@keyframes appear-elastic {
    0% { transform: scale(0) translateX(-50px); opacity: 0; }
    50% { transform: scale(1.1) translateX(5px); opacity: 1; }
    75% { transform: scale(0.95) translateX(-2px); opacity: 1; }
    100% { transform: scale(1) translateX(0); opacity: 1; }
}

.stimulus-appear-bounce { animation: appear-bounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.stimulus-appear-pop { animation: appear-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.stimulus-appear-drop { animation: appear-drop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.stimulus-appear-zoom { animation: appear-zoom 0.4s ease-out; }
.stimulus-appear-spin { animation: appear-spin 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.stimulus-appear-elastic { animation: appear-elastic 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ===== 答对时刺激物反馈动画 ===== */
@keyframes correct-pop {
    0% { transform: scale(1); filter: brightness(1); }
    40% { transform: scale(1.4); filter: brightness(1.3) drop-shadow(0 0 25px rgba(80,200,120,0.8)); }
    100% { transform: scale(0) rotate(15deg); opacity: 0; }
}

@keyframes star-burst {
    0% { transform: scale(0) rotate(0); opacity: 1; }
    100% { transform: scale(2) rotate(60deg); opacity: 0; }
}

/* ===== 答错时刺激物反馈动画 ===== */
@keyframes wrong-shake-red {
    0%, 100% { transform: translateX(0); filter: brightness(1); }
    15% { transform: translateX(-15px); filter: brightness(1.3) drop-shadow(0 0 20px rgba(229,57,53,0.7)); }
    30% { transform: translateX(12px); filter: brightness(1.3) drop-shadow(0 0 20px rgba(229,57,53,0.7)); }
    45% { transform: translateX(-9px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); filter: brightness(1.3) drop-shadow(0 0 20px rgba(229,57,53,0.7)); }
    100% { transform: translateX(0); filter: brightness(1); }
}

/* 刺激物反馈类 */
.stimulus-correct {
    animation: correct-pop 0.5s ease forwards !important;
}

.stimulus-wrong {
    animation: wrong-shake-red 0.5s ease forwards !important;
}

/* 小星星粒子效果 */
.star-particle {
    position: absolute;
    font-size: 28px;
    pointer-events: none;
    z-index: 100;
    animation: star-burst 0.7s ease-out forwards;
}

/* ===== 按钮点击反馈增强 ===== */
@keyframes btn-press {
    0% { transform: scale(1); }
    40% { transform: scale(0.82); }
    100% { transform: scale(1); }
}

.btn-clicked {
    animation: btn-press 0.2s ease !important;
}

/* ===== 保持原有的通用动画 ===== */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.08); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-12px); }
    30% { transform: translateX(10px); }
    45% { transform: translateX(-8px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* 原有类保留 */
.stimulus-bounce { animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.stimulus-float { animation: floatY 2s ease-in-out infinite; }
.feedback-pulse { animation: pulse 0.5s ease; }
.feedback-shake { animation: shake 0.5s ease; }

/* ===== v2.0.0 视觉增强 ===== */

/* 游戏页面动态渐变背景 */
body.game-active {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-size: 400% 400%;
    animation: gradientFlow 12s ease infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 主题皮肤覆盖 */
body[data-theme="forest"].game-active {
    background: linear-gradient(180deg, #134e4a 0%, #166534 50%, #14532d 100%);
    background-size: 400% 400%;
}
body[data-theme="ocean"].game-active {
    background: linear-gradient(180deg, #0c4a6e 0%, #075985 50%, #0369a1 100%);
    background-size: 400% 400%;
}
body[data-theme="candy"].game-active {
    background: linear-gradient(180deg, #831843 0%, #9d174d 50%, #be185d 100%);
    background-size: 400% 400%;
}

/* 粒子效果 */
@keyframes particleBurst {
    0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.5) rotate(var(--rot)); opacity: 0; }
}

.particle {
    position: absolute;
    font-size: 24px;
    pointer-events: none;
    z-index: 300;
    left: 50%;
    top: 50%;
    animation: particleBurst 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Combo浮动文字 */
@keyframes comboPop {
    0% { transform: translate(-50%, 0) scale(0.3); opacity: 0; }
    40% { transform: translate(-50%, -30px) scale(1.3); opacity: 1; }
    70% { transform: translate(-50%, -50px) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -80px) scale(0.8); opacity: 0; }
}

.combo-popup {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 2px 4px rgba(0,0,0,0.3);
    z-index: 250;
    pointer-events: none;
    animation: comboPop 1.2s ease-out forwards;
    white-space: nowrap;
}

/* 小狐狸 */
.game-fox {
    position: absolute;
    bottom: 100px;
    right: 12px;
    font-size: 36px;
    z-index: 50;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    pointer-events: none;
}

@keyframes foxBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-20px) scale(1.2); }
    60% { transform: translateY(-5px) scale(0.95); }
}

@keyframes foxShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px) rotate(-10deg); }
    40% { transform: translateX(6px) rotate(8deg); }
    60% { transform: translateX(-4px) rotate(-5deg); }
    80% { transform: translateX(2px) rotate(3deg); }
}

.fox-bounce { animation: foxBounce 0.6s ease; }
.fox-shake { animation: foxShake 0.5s ease; }

/* 终极挑战横幅 */
.ultimate-banner {
    position: absolute;
    top: 52px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    z-index: 100;
    animation: bannerPulse 1s ease infinite;
    box-shadow: 0 4px 15px rgba(255, 75, 43, 0.4);
    white-space: nowrap;
}

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

/* 按钮物理反馈增强 */
.answer-btn:active, .game-btn:active {
    transform: scale(0.88) translateY(2px);
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.2);
}

.answer-btn {
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.answer-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.answer-btn:active::after {
    width: 200%;
    height: 200%;
}

/* 按钮弹性回弹 */
@keyframes btnElastic {
    0% { transform: scale(1); }
    30% { transform: scale(0.85); }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.btn-clicked-elastic {
    animation: btnElastic 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 游戏屏幕容器增强 */
.game-screen {
    position: relative;
    overflow: hidden;
}

/* 动态背景装饰圆 */
@keyframes floatOrbit {
    0% { transform: translate(0, 0) rotate(0deg); opacity: 0.03; }
    33% { transform: translate(30px, -30px) rotate(120deg); opacity: 0.06; }
    66% { transform: translate(-20px, 20px) rotate(240deg); opacity: 0.04; }
    100% { transform: translate(0, 0) rotate(360deg); opacity: 0.03; }
}

/* 原有类保留 */
.stimulus-bounce { animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.stimulus-float { animation: floatY 2s ease-in-out infinite; }
.feedback-pulse { animation: pulse 0.5s ease; }
.feedback-shake { animation: shake 0.5s ease; }
