/* ==================== 全局样式重置 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ==================== CSS变量定义 ==================== */
:root {
    --ink: #2c2c2c;
    --paper: #f5f0e8;
    --paper-light: #faf7f2;
    --vermilion: #c0392b;
    --vermilion-light: #e74c3c;
    --indigo: #2c3e50;
    --indigo-light: #34495e;
    --gold: #b8860b;
    --gold-light: #daa520;
    --shadow: rgba(44, 44, 44, 0.15);
    --shadow-heavy: rgba(44, 44, 44, 0.3);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(44,62,80,0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(192,57,43,0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(184,134,11,0.02) 0%, transparent 50%),
        linear-gradient(180deg, var(--paper) 0%, var(--paper-light) 50%, var(--paper) 100%);
    background-attachment: fixed;
    -webkit-tap-highlight-color: transparent;
}

/* ==================== 页面容器 ==================== */
.page { display: none; min-height: 100vh; padding: 20px; max-width: 800px; margin: 0 auto; animation: fadeIn 0.4s ease; }
.page.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes inkDrop { 0% { transform: scale(0); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.6; } 100% { transform: scale(1); opacity: 1; } }
@keyframes comboFlash { 0% { transform: scale(1); } 50% { transform: scale(1.3); text-shadow: 0 0 20px var(--vermilion); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }

/* ==================== 水墨装饰 ==================== */
.ink-mountain { position: fixed; bottom: 0; left: 0; right: 0; height: 200px; pointer-events: none; z-index: 0; opacity: 0.06;
    background: radial-gradient(ellipse 300px 150px at 10% 100%, var(--ink) 0%, transparent 70%),
        radial-gradient(ellipse 200px 100px at 30% 100%, var(--ink) 0%, transparent 70%),
        radial-gradient(ellipse 400px 180px at 60% 100%, var(--ink) 0%, transparent 70%),
        radial-gradient(ellipse 250px 120px at 85% 100%, var(--ink) 0%, transparent 70%); }

/* ==================== 标题样式 ==================== */
.title-serif { font-family: 'Noto Serif SC', serif; }
.game-title { font-family: 'Noto Serif SC', serif; font-size: 2.5em; font-weight: 900; color: var(--ink); text-align: center; margin: 30px 0 10px; letter-spacing: 8px; }
.game-title::after { content: ''; display: block; width: 80px; height: 3px; background: linear-gradient(90deg, transparent, var(--vermilion), transparent); margin: 15px auto 0; }
.game-subtitle { font-family: 'Noto Serif SC', serif; font-size: 1em; color: var(--indigo); text-align: center; margin-bottom: 30px; letter-spacing: 4px; opacity: 0.7; }

/* ==================== 按钮样式 ==================== */
.btn { display: inline-block; padding: 12px 32px; border: none; border-radius: 8px; font-family: 'Noto Sans SC', sans-serif; font-size: 1em; font-weight: 500; cursor: pointer; transition: var(--transition); text-align: center; text-decoration: none; position: relative; overflow: hidden; touch-action: manipulation; }
.btn::after { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; background: rgba(255,255,255,0.2); border-radius: 50%; transform: translate(-50%,-50%); transition: width 0.4s, height 0.4s; }
.btn:active::after { width: 200px; height: 200px; }
.btn-primary { background: linear-gradient(135deg, var(--vermilion), var(--vermilion-light)); color: white; box-shadow: 0 4px 15px rgba(192,57,43,0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(192,57,43,0.4); }
.btn-secondary { background: linear-gradient(135deg, var(--indigo), var(--indigo-light)); color: white; box-shadow: 0 4px 15px rgba(44,62,80,0.3); }
.btn-secondary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(44,62,80,0.4); }
.btn-outline { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--paper); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: white; box-shadow: 0 4px 15px rgba(184,134,11,0.3); }
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(184,134,11,0.4); }
.btn-sm { padding: 8px 20px; font-size: 0.9em; }
.btn-lg { padding: 16px 48px; font-size: 1.1em; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ==================== 卡片样式 ==================== */
.card { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 4px 20px var(--shadow); margin-bottom: 20px; transition: var(--transition); position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--vermilion), var(--gold), var(--indigo)); }
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px var(--shadow-heavy); }

/* ==================== 输入框样式 ==================== */
.input-group { margin-bottom: 20px; }
.input-group label { display: block; font-size: 0.9em; color: var(--indigo); margin-bottom: 8px; font-weight: 500; }
.input-field { width: 100%; padding: 14px 18px; border: 2px solid #e0d8cc; border-radius: 10px; font-family: 'Noto Sans SC', sans-serif; font-size: 1em; color: var(--ink); background: var(--paper-light); transition: var(--transition); outline: none; }
.input-field:focus { border-color: var(--vermilion); box-shadow: 0 0 0 3px rgba(192,57,43,0.1); background: white; }
.input-field::placeholder { color: #b0a898; }

/* ==================== 登录页面 ==================== */
.login-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 90vh; padding: 20px; }
.login-card { background: white; border-radius: 20px; padding: 40px 30px; box-shadow: 0 8px 40px var(--shadow-heavy); width: 100%; max-width: 420px; text-align: center; position: relative; overflow: hidden; }
.login-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--vermilion), var(--gold), var(--indigo), var(--vermilion)); }
.login-card .game-title { font-size: 2em; margin-top: 0; }
.login-tabs { display: flex; margin: 25px 0; border-bottom: 2px solid #e8e0d4; }
.login-tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; font-weight: 500; color: #999; transition: var(--transition); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.login-tab.active { color: var(--vermilion); border-bottom-color: var(--vermilion); }
.login-form { text-align: left; }
.login-error { color: var(--vermilion); font-size: 0.85em; margin-bottom: 10px; min-height: 20px; }

/* ==================== 主页大厅 ==================== */
.home-header { text-align: center; padding: 20px 0; }
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 20px 0; }
.mode-card { background: white; border-radius: 16px; padding: 24px 16px; text-align: center; cursor: pointer; transition: var(--transition); box-shadow: 0 4px 15px var(--shadow); position: relative; overflow: hidden; }
.mode-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px var(--shadow-heavy); }
.mode-card .mode-icon { font-size: 2.5em; margin-bottom: 10px; display: block; }
.mode-card .mode-name { font-family: 'Noto Serif SC', serif; font-size: 1.15em; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.mode-card .mode-desc { font-size: 0.8em; color: #888; line-height: 1.4; }
.mode-card .mode-meta { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; margin-top: 12px; padding: 4px 10px; border-radius: 999px; background: #f7f1e7; color: #7b6a54; font-size: 0.72em; line-height: 1.25; }
.mode-card:nth-child(1) { border-top: 3px solid var(--vermilion); }
.mode-card:nth-child(2) { border-top: 3px solid var(--indigo); }
.mode-card:nth-child(3) { border-top: 3px solid var(--gold); }
.mode-card:nth-child(4) { border-top: 3px solid #8e44ad; }

/* 每日诗词 */
.daily-poem { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 4px 15px var(--shadow); text-align: center; margin: 20px 0; position: relative; cursor: pointer; transition: var(--transition); }
.daily-poem:hover { transform: translateY(-2px); box-shadow: 0 8px 25px var(--shadow-heavy); }
.daily-poem::before { content: '\201C'; font-family: 'Noto Serif SC', serif; font-size: 4em; color: var(--vermilion); opacity: 0.15; position: absolute; top: -5px; left: 15px; }
.daily-poem-label { display: inline-block; margin-bottom: 10px; padding: 3px 12px; border-radius: 999px; background: rgba(184,134,11,0.12); color: var(--gold); font-size: 0.78em; font-weight: 600; }
.daily-poem .poem-text { font-family: 'Noto Serif SC', serif; font-size: 1.2em; line-height: 1.8; color: var(--ink); margin-bottom: 10px; }
.daily-poem .poem-author { font-size: 0.9em; color: #888; }

/* 用户信息栏 */
.user-bar { display: flex; align-items: center; justify-content: space-between; background: white; border-radius: 12px; padding: 12px 20px; box-shadow: 0 2px 10px var(--shadow); margin-bottom: 20px; }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--vermilion), var(--gold)); display: flex; align-items: center; justify-content: center; color: white; font-family: 'Noto Serif SC', serif; font-weight: 700; font-size: 1.1em; }
.user-name { font-weight: 500; font-size: 0.95em; }
.user-level { font-size: 0.8em; color: var(--gold); font-weight: 600; }
.user-points { font-size: 0.85em; color: var(--indigo); }

/* ==================== 个人中心 ==================== */
.profile-header { text-align: center; padding: 30px 0; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, var(--vermilion), var(--gold)); display: flex; align-items: center; justify-content: center; color: white; font-family: 'Noto Serif SC', serif; font-weight: 900; font-size: 2em; margin: 0 auto 15px; box-shadow: 0 4px 20px rgba(192,57,43,0.3); }
.profile-name { font-family: 'Noto Serif SC', serif; font-size: 1.5em; font-weight: 700; margin-bottom: 5px; }
.profile-level { display: inline-block; padding: 4px 16px; background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: white; border-radius: 20px; font-size: 0.85em; font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.stat-item { background: white; border-radius: 12px; padding: 16px; text-align: center; box-shadow: 0 2px 10px var(--shadow); }
.stat-value { font-family: 'Noto Serif SC', serif; font-size: 1.5em; font-weight: 700; color: var(--vermilion); }
.stat-label { font-size: 0.8em; color: #888; margin-top: 4px; }

/* ==================== 游戏页面通用 ==================== */
.game-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 2px solid #e8e0d4; }
.game-header .back-btn { background: none; border: none; font-size: 1.5em; cursor: pointer; color: var(--ink); padding: 5px; transition: var(--transition); }
.game-header .back-btn:hover { color: var(--vermilion); }
.game-header .game-mode-title { font-family: 'Noto Serif SC', serif; font-size: 1.3em; font-weight: 700; }
.game-stats { display: flex; gap: 15px; align-items: center; }
.game-stat { display: flex; align-items: center; gap: 5px; font-size: 0.9em; }
.lives { display: flex; gap: 4px; }
.life-heart { font-size: 1.2em; transition: var(--transition); }
.life-heart.lost { opacity: 0.2; transform: scale(0.8); }
.timer { font-family: 'Noto Serif SC', serif; font-size: 1.3em; font-weight: 700; color: var(--indigo); min-width: 50px; text-align: center; }
.timer.urgent { color: var(--vermilion); animation: pulse 0.5s ease infinite; }
.progress-bar { width: 100%; height: 8px; background: #e8e0d4; border-radius: 4px; overflow: hidden; margin: 15px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--vermilion), var(--gold)); border-radius: 4px; transition: width 0.5s ease; }

/* 关卡信息 */
.level-info { text-align: center; padding: 20px; background: white; border-radius: 16px; box-shadow: 0 4px 15px var(--shadow); margin-bottom: 20px; }
.level-number { font-size: 0.9em; color: #888; margin-bottom: 8px; }
.level-keyword { font-family: 'Noto Serif SC', serif; font-size: 3em; font-weight: 900; color: var(--vermilion); animation: inkDrop 0.6s ease; }
.level-hint { font-size: 0.9em; color: #888; margin-top: 8px; }

/* 诗句输入区 */
.poem-input-area { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 4px 15px var(--shadow); margin-bottom: 20px; }
.poem-input-area .input-field { font-family: 'Noto Serif SC', serif; font-size: 1.2em; text-align: center; padding: 18px; }
.poem-input-area .input-field:focus { border-color: var(--vermilion); }
.input-actions { display: flex; gap: 10px; margin-top: 15px; }
.input-actions .btn { flex: 1; }

/* 连击显示 */
.combo-display { text-align: center; margin: 10px 0; font-family: 'Noto Serif SC', serif; font-size: 1.2em; font-weight: 700; color: var(--gold); min-height: 30px; }
.combo-display.active { animation: comboFlash 0.5s ease; }

/* 提示区域 */
.hint-area { background: var(--paper); border: 2px dashed #d4c9b8; border-radius: 12px; padding: 16px; text-align: center; margin-bottom: 20px; min-height: 50px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; }
.hint-text { font-size: 0.9em; color: var(--indigo); }
.hint-author { font-size: 0.8em; color: #888; }

/* 已答诗句列表 */
.answered-list { background: white; border-radius: 16px; padding: 20px; box-shadow: 0 4px 15px var(--shadow); margin-bottom: 20px; max-height: 300px; overflow-y: auto; }
.answered-list h3 { font-family: 'Noto Serif SC', serif; font-size: 1em; color: var(--indigo); margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #e8e0d4; }
.answered-item { padding: 10px 0; border-bottom: 1px dashed #e8e0d4; animation: slideUp 0.3s ease; }
.answered-item:last-child { border-bottom: none; }
.answered-item .poem-line { font-family: 'Noto Serif SC', serif; font-size: 1em; color: var(--ink); }
.answered-item .poem-source { font-size: 0.8em; color: #999; margin-top: 3px; }

/* ==================== 尾字接龙特有样式 ==================== */
.chain-display { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 4px 15px var(--shadow); margin-bottom: 20px; text-align: center; }
.chain-current { font-family: 'Noto Serif SC', serif; font-size: 1.8em; font-weight: 700; color: var(--ink); line-height: 1.6; margin-bottom: 10px; }
.chain-target-char { display: inline-block; font-size: 1.5em; font-weight: 900; color: var(--vermilion); background: rgba(192,57,43,0.08); padding: 4px 12px; border-radius: 8px; margin: 10px 0; animation: pulse 1s ease infinite; }
.chain-count { font-size: 0.9em; color: var(--gold); font-weight: 600; }

/* ==================== 对战模式 ==================== */
.battle-matching { text-align: center; padding: 60px 20px; }
.matching-spinner { width: 80px; height: 80px; border: 4px solid #e8e0d4; border-top-color: var(--vermilion); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 20px; }
.matching-text { font-family: 'Noto Serif SC', serif; font-size: 1.2em; color: var(--indigo); }
.battle-arena { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 4px 15px var(--shadow); margin-bottom: 20px; }
.battle-player { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.battle-player .player-avatar { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5em; color: white; font-weight: 700; }
.battle-player .player-name { font-weight: 600; font-size: 0.95em; }
.battle-player .player-level { font-size: 0.8em; color: #888; }
.battle-player.me .player-avatar { background: linear-gradient(135deg, var(--vermilion), var(--gold)); }
.battle-player.opponent .player-avatar { background: linear-gradient(135deg, var(--indigo), #8e44ad); }
.battle-vs-text { font-family: 'Noto Serif SC', serif; font-size: 2em; font-weight: 900; color: var(--vermilion); }
.battle-vs-layout { display: flex; align-items: center; justify-content: space-around; }
.battle-round-info { text-align: center; padding: 15px; background: var(--paper); border-radius: 12px; margin-bottom: 15px; }
.battle-round-info .round-number { font-family: 'Noto Serif SC', serif; font-size: 1.1em; font-weight: 700; color: var(--ink); }
.battle-round-info .round-keyword { font-size: 0.9em; color: var(--vermilion); margin-top: 5px; }
.battle-log { max-height: 200px; overflow-y: auto; margin-bottom: 15px; }
.battle-log-item { padding: 10px; border-radius: 8px; margin-bottom: 8px; animation: slideUp 0.3s ease; }
.battle-log-item.player { background: rgba(192,57,43,0.05); border-left: 3px solid var(--vermilion); }
.battle-log-item.opponent { background: rgba(44,62,80,0.05); border-left: 3px solid var(--indigo); }
.battle-log-item .log-name { font-weight: 600; font-size: 0.85em; margin-bottom: 3px; }
.battle-log-item .log-poem { font-family: 'Noto Serif SC', serif; font-size: 1em; }
.battle-log-item .log-source { font-size: 0.8em; color: #999; margin-top: 3px; }
.battle-log-item.fail { color: var(--vermilion); font-style: italic; }

/* ==================== 结算页面 ==================== */
.result-container { text-align: center; padding: 30px 0; }
.result-title { font-family: 'Noto Serif SC', serif; font-size: 2em; font-weight: 900; color: var(--ink); margin-bottom: 10px; }
.result-subtitle { font-size: 1em; color: #888; margin-bottom: 30px; }
.result-score { font-family: 'Noto Serif SC', serif; font-size: 4em; font-weight: 900; color: var(--vermilion); line-height: 1; margin-bottom: 5px; }
.result-score-label { font-size: 0.9em; color: #888; margin-bottom: 30px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.result-stat { background: white; border-radius: 12px; padding: 16px; box-shadow: 0 2px 10px var(--shadow); }
.result-stat .value { font-family: 'Noto Serif SC', serif; font-size: 1.3em; font-weight: 700; color: var(--indigo); }
.result-stat .label { font-size: 0.8em; color: #888; margin-top: 4px; }
.level-up-notice { background: linear-gradient(135deg, rgba(184,134,11,0.1), rgba(218,165,32,0.1)); border: 2px solid var(--gold); border-radius: 16px; padding: 24px; margin: 20px 0; animation: pulse 1s ease 3; }
.level-up-notice .level-up-text { font-family: 'Noto Serif SC', serif; font-size: 1.3em; font-weight: 700; color: var(--gold); margin-bottom: 5px; }
.level-up-notice .level-up-detail { font-size: 0.9em; color: var(--indigo); }
.result-actions { display: flex; gap: 12px; margin-top: 30px; }
.result-actions .btn { flex: 1; }

/* ==================== 每日练习 ==================== */
.daily-header { text-align: center; padding: 20px; background: white; border-radius: 16px; box-shadow: 0 4px 15px var(--shadow); margin-bottom: 20px; }
.daily-date { font-family: 'Noto Serif SC', serif; font-size: 1.2em; font-weight: 700; color: var(--ink); }
.daily-streak { font-size: 0.9em; color: var(--gold); margin-top: 5px; }
.daily-section { background: white; border-radius: 16px; padding: 24px; box-shadow: 0 4px 15px var(--shadow); margin-bottom: 20px; }
.daily-section h3 { font-family: 'Noto Serif SC', serif; font-size: 1.1em; color: var(--indigo); margin-bottom: 15px; padding-bottom: 10px; border-bottom: 2px solid #e8e0d4; }
.section-status { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 0.75em; margin-left: 8px; }
.section-status.pending { background: #e8e0d4; color: #888; }
.section-status.completed { background: rgba(39,174,96,0.1); color: #27ae60; }

/* ==================== Toast 通知 ==================== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast { background: white; border-radius: 12px; padding: 14px 20px; box-shadow: 0 4px 20px var(--shadow-heavy); animation: slideInRight 0.3s ease; max-width: 300px; font-size: 0.9em; }
.toast.success { border-left: 4px solid #27ae60; }
.toast.error { border-left: 4px solid var(--vermilion); }
.toast.info { border-left: 4px solid var(--indigo); }

/* ==================== 历史记录 ==================== */
.history-list { max-height: 400px; overflow-y: auto; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px dashed #e8e0d4; }
.history-item:last-child { border-bottom: none; }
.history-mode { font-weight: 600; font-size: 0.9em; }
.history-score { font-family: 'Noto Serif SC', serif; font-weight: 700; color: var(--vermilion); }
.history-date { font-size: 0.8em; color: #999; }
.history-result { font-size: 0.8em; padding: 2px 8px; border-radius: 8px; }
.history-result.win { background: rgba(39,174,96,0.1); color: #27ae60; }
.history-result.lose { background: rgba(192,57,43,0.1); color: var(--vermilion); }

/* ==================== 底部导航 ==================== */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: white; box-shadow: 0 -2px 15px var(--shadow); display: flex; z-index: 100; max-width: 800px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.nav-item { flex: 1; text-align: center; padding: 10px 0; cursor: pointer; transition: var(--transition); color: #999; font-size: 0.75em; }
.nav-item.active { color: var(--vermilion); }
.nav-item .nav-icon { font-size: 1.4em; display: block; margin-bottom: 2px; }

/* ==================== 模态框 ==================== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1500; display: none; align-items: center; justify-content: center; animation: fadeIn 0.3s ease; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal { background: white; border-radius: 20px; padding: 30px; max-width: 400px; width: 90%; text-align: center; animation: slideUp 0.3s ease; }
.modal h3 { font-family: 'Noto Serif SC', serif; font-size: 1.3em; margin-bottom: 15px; color: var(--ink); }
.modal p { font-size: 0.95em; color: #666; margin-bottom: 20px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ==================== 难度选择 ==================== */
.difficulty-select { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; justify-content: center; }
.difficulty-btn { padding: 10px 20px; border: 2px solid #e8e0d4; border-radius: 10px; background: white; cursor: pointer; font-family: 'Noto Sans SC', sans-serif; font-size: 0.9em; transition: var(--transition); text-align: center; }
.difficulty-btn:hover { border-color: var(--vermilion); }
.difficulty-btn.selected { border-color: var(--vermilion); background: rgba(192,57,43,0.05); color: var(--vermilion); font-weight: 600; }
.difficulty-btn .diff-name { font-weight: 600; display: block; }
.difficulty-btn .diff-desc { font-size: 0.8em; color: #999; margin-top: 3px; }

/* ==================== 诗词库筛选面板 ==================== */
.filter-panel {
    margin: 30px auto 20px;
    max-width: 600px;
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px var(--shadow);
}
.filter-panel-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.15em;
    color: var(--indigo);
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e0d4;
}
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
    flex-wrap: wrap;
}
.filter-tab {
    padding: 8px 18px;
    border-radius: 20px;
    background: #f5f0e8;
    color: #666;
    font-size: 0.9em;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}
.filter-tab:hover {
    background: #ebe5d8;
}
.filter-tab.active {
    background: var(--vermilion);
    color: white;
    font-weight: 500;
}
.filter-content {
    animation: fadeIn 0.3s ease;
}
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-height: 180px;
    overflow-y: auto;
    padding: 5px;
}
.filter-chip {
    padding: 8px 16px;
    border: 1.5px solid #e8e0d4;
    border-radius: 20px;
    background: white;
    color: var(--ink);
    font-size: 0.85em;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.filter-chip:hover {
    border-color: var(--gold);
    background: rgba(184,134,11,0.05);
}
.filter-chip.selected {
    border-color: var(--vermilion);
    background: rgba(192,57,43,0.08);
    color: var(--vermilion);
    font-weight: 500;
}
.filter-status {
    text-align: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e8e0d4;
    font-size: 0.85em;
    color: #888;
    font-family: 'Noto Serif SC', serif;
}

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4c9b8; border-radius: 3px; }

/* ==================== 响应式 ==================== */
@media (max-width: 600px) {
    .page { padding: 14px; padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
    .game-title { font-size: 1.8em; letter-spacing: 4px; }
    .home-header { padding: 8px 0; }
    .mode-grid { gap: 10px; margin: 14px 0; }
    .mode-card { padding: 16px 10px; min-height: 176px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
    .mode-card .mode-icon { font-size: 2em; }
    .mode-card .mode-meta { width: 100%; font-size: 0.68em; padding: 4px 6px; white-space: normal; }
    .user-bar { padding: 10px 12px; gap: 10px; }
    .user-points { white-space: nowrap; }
    .stats-grid, .result-stats { gap: 8px; }
    .stat-value { font-size: 1.2em; }
    .result-score { font-size: 3em; }
    .login-card { padding: 30px 20px; }
    .battle-vs-layout { flex-direction: column; gap: 15px; }
    .result-actions { flex-direction: column; }
    .input-actions, .modal-actions, .recite-actions { flex-direction: column; }
    .level-keyword { font-size: 2.5em; }
    .chain-current { font-size: 1.4em; }
    .filter-panel { padding: 16px 12px; margin-top: 18px; }
    .filter-tab, .filter-chip { min-height: 38px; display: inline-flex; align-items: center; }
    .toast-container { top: 12px; left: 12px; right: 12px; }
    .toast { max-width: none; }
}
@media (min-width: 601px) {
    .page { padding-bottom: 80px; }
}

/* ==================== 诗词详情弹窗 ==================== */
#poemDetailModal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.poem-detail-modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    font-size: 1.8em;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: var(--vermilion); }
.poem-detail-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e8e0d4;
}
.poem-detail-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.4em;
    color: var(--ink);
    margin-bottom: 4px;
}
.poem-detail-author {
    font-size: 0.9em;
    color: #888;
}
.poem-detail-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.15em;
    line-height: 2;
    color: var(--ink);
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #faf8f3;
    border-radius: 12px;
}
.poem-detail-section {
    margin-bottom: 16px;
}
.poem-detail-section-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1em;
    color: var(--indigo);
    margin-bottom: 8px;
    padding-left: 8px;
    border-left: 3px solid var(--gold);
}
.poem-detail-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.poem-note-item {
    background: #f5f0e8;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85em;
}
.poem-note-item .note-key {
    color: var(--vermilion);
    font-weight: 600;
}
.poem-note-item .note-val {
    color: #666;
    margin-left: 4px;
}
.poem-detail-translation, .poem-detail-appreciation {
    font-size: 0.9em;
    line-height: 1.8;
    color: #555;
    padding: 10px;
    background: #faf8f3;
    border-radius: 8px;
}

/* ==================== 排行榜 ==================== */
.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
}
.leaderboard-tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: #f5f0e8;
    color: #666;
    font-size: 0.85em;
    cursor: pointer;
    transition: var(--transition);
}
.leaderboard-tab.active {
    background: var(--vermilion);
    color: white;
}
.leaderboard-list {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 20px var(--shadow);
}
.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0ebe0;
    gap: 12px;
}
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-rank {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9em;
    flex-shrink: 0;
}
.leaderboard-rank.rank-1 { background: #FFD700; color: #8B6914; }
.leaderboard-rank.rank-2 { background: #C0C0C0; color: #555; }
.leaderboard-rank.rank-3 { background: #CD7F32; color: white; }
.leaderboard-rank.rank-other { background: #f5f0e8; color: #888; }
.leaderboard-name {
    flex: 1;
    font-weight: 500;
}
.leaderboard-score {
    font-weight: 600;
    color: var(--vermilion);
}

/* ==================== 背诵模式 ==================== */
.recite-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}
.recite-progress, .recite-score {
    font-size: 0.9em;
    color: #666;
}
.recite-poem-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px var(--shadow);
    text-align: center;
}
.recite-poem-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2em;
    color: var(--ink);
    margin-bottom: 4px;
}
.recite-poem-author {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 20px;
}
.recite-blanks {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1em;
    line-height: 2.2;
    color: var(--ink);
}
.recite-blank {
    display: inline-block;
    width: 40px;
    height: 32px;
    border-bottom: 2px solid var(--gold);
    margin: 0 2px;
    text-align: center;
    vertical-align: middle;
    font-size: 1em;
    background: transparent;
    border-top: none; border-left: none; border-right: none;
    outline: none;
    font-family: 'Noto Serif SC', serif;
}
.recite-blank:focus {
    border-bottom-color: var(--vermilion);
}
.recite-blank.correct {
    border-bottom-color: #27ae60;
    color: #27ae60;
}
.recite-blank.wrong {
    border-bottom-color: var(--vermilion);
    color: var(--vermilion);
}
.recite-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.recite-hint-area {
    background: #fff9e6;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    text-align: center;
}
.recite-hint-text {
    font-size: 0.9em;
    color: #8a6d3b;
}

/* ==================== 成就系统 ==================== */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.achievement-item {
    text-align: center;
    padding: 10px 6px;
    border-radius: 12px;
    background: #faf8f3;
    transition: var(--transition);
}
.achievement-item.unlocked {
    background: rgba(184,134,11,0.1);
}
.achievement-item.locked {
    opacity: 0.5;
    filter: grayscale(1);
}
.achievement-icon {
    font-size: 1.8em;
    margin-bottom: 4px;
}
.achievement-name {
    font-size: 0.7em;
    color: var(--ink);
    font-weight: 500;
}
@media (max-width: 600px) {
    .achievements-grid { grid-template-columns: repeat(3, 1fr); }
    .poem-detail-modal { padding: 16px; }
}

/* ==================== 视觉特效增强 ==================== */

/* 粒子画布 */
#particleCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* 正确答题特效 */
.correct-flash {
    animation: correctFlash 0.6s ease;
}
@keyframes correctFlash {
    0% { background: rgba(39,174,96,0); }
    30% { background: rgba(39,174,96,0.15); }
    100% { background: rgba(39,174,96,0); }
}

/* 错误答题特效 */
.wrong-shake {
    animation: wrongShake 0.5s ease;
}
@keyframes wrongShake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* 水墨扩散效果 */
.ink-spread {
    position: relative;
    overflow: hidden;
}
.ink-spread::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: radial-gradient(circle, rgba(44,62,80,0.08) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: 0;
}
.ink-spread:active::before {
    width: 300px; height: 300px;
}

/* 浮动花瓣 */
.petal {
    position: fixed;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.6;
    animation: petalFall linear forwards;
}
@keyframes petalFall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 0.8; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* 连击光效 */
.combo-glow {
    text-shadow: 0 0 10px var(--gold), 0 0 20px var(--gold), 0 0 30px var(--vermilion);
    animation: comboGlow 1s ease infinite alternate;
}
@keyframes comboGlow {
    from { text-shadow: 0 0 5px var(--gold); }
    to { text-shadow: 0 0 20px var(--gold), 0 0 40px var(--vermilion); }
}

/* 升级特效 */
.level-up-anim {
    animation: levelUpPop 1s ease;
}
@keyframes levelUpPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* 收藏项样式 */
.collection-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid var(--gold);
}
.collection-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px var(--shadow-heavy);
}
.collection-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1em;
    color: var(--ink);
    margin-bottom: 4px;
}
.collection-author {
    font-size: 0.85em;
    color: #888;
    margin-bottom: 6px;
}
.collection-text {
    font-size: 0.9em;
    color: #666;
    line-height: 1.6;
}

/* 诗词速配模式 */
.match-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px var(--shadow);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}
.match-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px var(--shadow-heavy);
}
.match-card.selected {
    border-color: var(--vermilion);
    background: rgba(192,57,43,0.03);
}
.match-card.correct {
    border-color: #27ae60;
    background: rgba(39,174,96,0.05);
    animation: correctFlash 0.5s ease;
}
.match-card.wrong {
    border-color: var(--vermilion);
    background: rgba(192,57,43,0.05);
    animation: wrongShake 0.5s ease;
}
.match-poem-text {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2em;
    line-height: 1.8;
    color: var(--ink);
    margin-bottom: 12px;
}
.match-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
}
.match-option {
    padding: 12px;
    border: 1.5px solid #e8e0d4;
    border-radius: 10px;
    background: #faf8f3;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9em;
}
.match-option:hover {
    border-color: var(--gold);
    background: rgba(184,134,11,0.05);
}
.match-option.correct {
    border-color: #27ae60;
    background: rgba(39,174,96,0.1);
    color: #27ae60;
}
.match-option.wrong {
    border-color: var(--vermilion);
    background: rgba(192,57,43,0.1);
    color: var(--vermilion);
}

/* 数据管理按钮 */
.data-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}
