* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    padding-bottom: 100px;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s, visibility 0.5s;
}

.loader-container {
    text-align: center;
}

.loader-brush {
    font-size: 64px;
    animation: brushMove 2s ease-in-out infinite;
}

@keyframes brushMove {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

.loader-text {
    font-size: 24px;
    margin-top: 20px;
    color: #8B4513;
}

.loader-progress {
    width: 300px;
    height: 10px;
    background: #ddd;
    border-radius: 5px;
    margin: 20px auto;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #8B4513, #D2691E);
    width: 0%;
    transition: width 0.3s;
}

.loader-poems {
    margin-top: 20px;
}

.loader-poem {
    display: block;
    font-size: 18px;
    color: #666;
    margin: 5px 0;
    opacity: 0;
    animation: fadeIn 1s forwards;
}

.loader-poem:nth-child(1) { animation-delay: 0s; }
.loader-poem:nth-child(2) { animation-delay: 0.2s; }
.loader-poem:nth-child(3) { animation-delay: 0.4s; }
.loader-poem:nth-child(4) { animation-delay: 0.6s; }

@keyframes fadeIn {
    to { opacity: 1; }
}

header {
    background: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-title {
    text-align: center;
    color: #8B4513;
    font-size: 28px;
    margin-bottom: 10px;
}

.nav-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-link {
    text-decoration: none;
    color: #333;
    padding: 8px 15px;
    border-radius: 20px;
    transition: background 0.3s;
}

.nav-link:hover {
    background: #f0f0f0;
}

.sound-controls {
    position: fixed;
    top: 100px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.sound-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    font-size: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.sound-btn:hover {
    transform: scale(1.1);
}

.container {
    max-width: 800px;
    margin: 120px auto 20px;
    padding: 0 20px;
}

.page-title {
    text-align: center;
    color: white;
    font-size: 32px;
    margin-bottom: 30px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.game-stats {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

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

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #8B4513;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.daily-challenge-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 20px;
    transition: transform 0.3s;
}

.daily-challenge-btn:hover {
    transform: translateY(-2px);
}

.top-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.top-btn {
    padding: 10px 20px;
    background: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: background 0.3s;
}

.top-btn:hover {
    background: #f0f0f0;
}

.game-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.game-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.game-card-content {
    text-align: center;
}

.game-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.game-title {
    font-size: 20px;
    color: #333;
    margin-bottom: 10px;
}

.game-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.difficulty-tag {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.difficulty-tag.easy {
    background: #e8f5e9;
    color: #2e7d32;
}

.difficulty-tag.medium {
    background: #fff3e0;
    color: #e65100;
}

.difficulty-tag.hard {
    background: #ffebee;
    color: #c62828;
}

.game-area {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.current-game-title {
    font-size: 24px;
    color: #333;
}

.back-btn {
    padding: 8px 15px;
    background: #f0f0f0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.back-btn:hover {
    background: #e0e0e0;
}

.game-content {
    min-height: 300px;
}

/* ====== 增强交互效果 ====== */

/* 按钮波纹效果 */
button {
    position: relative;
    overflow: hidden;
}

button::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.6s ease-out, height 0.6s ease-out;
}

button:active::after {
    width: 300%;
    height: 300%;
}

/* 得分弹跳动画 */
.score-bounce {
    animation: scoreBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scoreBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* 游戏卡片悬浮动画 */
.game-card {
    animation: cardFloat 3s ease-in-out infinite;
}

.game-card:nth-child(2) { animation-delay: 0.5s; }
.game-card:nth-child(3) { animation-delay: 1s; }

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

/* 游戏卡片悬停增强 */
.game-card:hover {
    transform: translateY(-10px) scale(1.02) !important;
    box-shadow: 0 15px 40px rgba(0,0,0,0.25) !important;
}

/* 游戏开始/结束特效 */
.game-start {
    animation: gameStart 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes gameStart {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.game-win {
    animation: gameWin 1s ease-out;
}

@keyframes gameWin {
    0% { transform: scale(1); }
    25% { transform: scale(1.1) rotate(-3deg); }
    50% { transform: scale(1.05) rotate(3deg); }
    75% { transform: scale(1.02) rotate(-1deg); }
    100% { transform: scale(1) rotate(0); }
}

.game-lose {
    animation: gameLose 0.5s ease-out;
}

@keyframes gameLose {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* 连击特效 */
.combo-effect {
    animation: comboEffect 0.6s ease-out;
}

@keyframes comboEffect {
    0% {
        opacity: 0;
        transform: scale(2);
    }
    50% {
        opacity: 1;
        transform: scale(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(1);
    }
}

/* 粒子特效容器 */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.particle {
    position: absolute;
    font-size: 20px;
    animation: particleFloat 2s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) scale(0.5) rotate(360deg);
    }
}

/* 统计数字渐变效果 */
.stat-value {
    background: linear-gradient(135deg, #8B4513, #DAA520, #8B4513);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 每日挑战按钮呼吸效果 */
.daily-challenge-btn {
    animation: challengePulse 2s ease-in-out infinite;
}

@keyframes challengePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(255, 107, 107, 0);
    }
}

/* 标签页切换动画 */
.tab-content {
    animation: tabFadeIn 0.3s ease-out;
}

@keyframes tabFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 输入框聚焦效果 */
.game-input {
    transition: all 0.3s ease;
}

.game-input:focus {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(139, 69, 19, 0.3);
}

/* 选项按钮悬停效果 */
.option-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.option-btn:hover {
    transform: translateX(10px);
    background: linear-gradient(90deg, #f5f5dc, #fffaf0);
}

/* 正确答案高亮 */
.correct-answer {
    animation: correctHighlight 0.5s ease-out;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9) !important;
}

@keyframes correctHighlight {
    0% {
        background: linear-gradient(135deg, #fff9c4, #fff59d) !important;
    }
    100% {
        background: linear-gradient(135deg, #e8f5e9, #c8e6c9) !important;
    }
}

/* 错误答案抖动 */
.wrong-answer {
    animation: wrongShake 0.5s ease-out;
    background: linear-gradient(135deg, #ffebee, #ffcdd2) !important;
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* 进度条动画 */
.progress-bar {
    transition: width 0.5s ease-out;
}

/* 倒计时警告效果 */
.countdown-warning {
    animation: countdownFlash 0.5s ease-in-out infinite;
}

@keyframes countdownFlash {
    0%, 100% { color: #c62828; }
    50% { color: #ff5252; }
}

.tang-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    max-width: 600px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    transition: color 0.3s;
}

.nav-item:hover {
    color: #8B4513;
}

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

.nav-text {
    font-size: 12px;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .nav-links {
        gap: 10px;
    }

    .header-title {
        font-size: 22px;
    }

    /* 游戏区域移动端优化 */
    .game-area {
        padding: 15px;
        border-radius: 10px;
    }

    .game-area h2 {
        font-size: 20px;
    }

    /* 游戏选项按钮移动端优化 */
    .game-area .option-btn,
    .game-area button {
        padding: 10px 14px;
        font-size: 14px;
        min-height: 44px;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 8px;
    }

    /* 游戏题目区域 */
    .game-area .question,
    .game-area .poem-text,
    .game-area .question-text {
        font-size: 15px;
        line-height: 1.8;
        padding: 10px 0;
    }

    /* 游戏统计数字 */
    .stat-number {
        font-size: 24px;
    }

    .stat-label {
        font-size: 12px;
    }

    /* 选项网格改为单列 */
    .game-area .options-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .game-area {
        padding: 10px;
    }

    .game-area h2 {
        font-size: 18px;
    }

    .game-area .option-btn,
    .game-area button {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* ====== 排行榜 / 成就 模态框（唐风） ====== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(43, 28, 14, 0.62);
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.modal.active {
    display: flex;
}
.modal-content {
    width: 100%;
    max-width: 560px;
    max-height: 82vh;
    overflow-y: auto;
    background: #fdfaf5;
    border: 1px solid #e8dcc8;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(43, 28, 14, 0.35);
    animation: modalIn .28s cubic-bezier(.34, 1.4, .64, 1);
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(22px) scale(.97); }
    to { opacity: 1; transform: none; }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 2px solid #DAA520;
    position: sticky;
    top: 0;
    background: #fdfaf5;
    border-radius: 14px 14px 0 0;
}
.modal-title {
    margin: 0;
    font-size: 19px;
    color: #8B4513;
}
.modal .close {
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    color: #a08060;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background .2s, color .2s;
}
.modal .close:hover,
.modal .close:focus-visible {
    color: #8B4513;
    background: #f4e9d4;
    outline: none;
}

/* 排行榜 */
.leaderboard-list { padding: 18px 20px 22px; }
.lb-empty {
    text-align: center;
    color: #a08060;
    font-size: 15px;
    line-height: 2;
    padding: 26px 0;
}
.lb-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.lb-stat {
    background: #f8f1e3;
    border: 1px solid #e8dcc8;
    border-radius: 10px;
    text-align: center;
    padding: 12px 6px;
}
.lb-stat b {
    display: block;
    font-size: 22px;
    color: #8B4513;
}
.lb-stat span {
    font-size: 12px;
    color: #a08060;
}
.lb-modes { margin-bottom: 16px; }
.lb-mode-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    border-bottom: 1px dashed #e8dcc8;
    font-size: 14px;
}
.lb-mode-name { color: #6b5439; font-weight: 600; }
.lb-mode-detail { color: #a08060; font-size: 13px; }
.lb-recent-title {
    font-size: 14px;
    color: #8B4513;
    font-weight: 700;
    margin: 4px 0 8px;
}
.lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
}
.lb-row:nth-child(odd) { background: #faf4e8; }
.lb-badge {
    min-width: 26px;
    text-align: center;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 12px;
    color: #fff;
}
.lb-badge.win { background: #b8860b; }
.lb-badge.lose { background: #b3a08a; }
.lb-mode { color: #6b5439; flex: 1; }
.lb-score { color: #8B4513; font-weight: 700; }
.lb-date { color: #b3a08a; font-size: 12px; }

/* 成就 */
.achievements-grid {
    padding: 18px 20px 22px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.ach-progress {
    grid-column: 1 / -1;
    text-align: center;
    color: #8B4513;
    font-weight: 700;
    font-size: 14px;
    background: #f8f1e3;
    border: 1px solid #e8dcc8;
    border-radius: 10px;
    padding: 10px;
}
.achievement-card {
    border: 1px solid #e8dcc8;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    background: #fffdf8;
    transition: transform .2s, box-shadow .2s;
}
.achievement-card.unlocked {
    border-color: #DAA520;
    background: linear-gradient(160deg, #fff8e7, #fdf0d0);
    box-shadow: 0 4px 14px rgba(218, 165, 32, .22);
}
.achievement-card.unlocked:hover { transform: translateY(-3px); }
.achievement-card.locked { opacity: .55; filter: grayscale(.6); }
.achievement-icon { font-size: 28px; margin-bottom: 6px; }
.achievement-name {
    font-size: 14px;
    font-weight: 700;
    color: #8B4513;
    margin-bottom: 4px;
}
.achievement-desc {
    font-size: 12px;
    color: #a08060;
    line-height: 1.6;
    margin-bottom: 6px;
}
.achievement-state {
    font-size: 11px;
    color: #b8860b;
    border-top: 1px dashed #e8dcc8;
    padding-top: 6px;
}
.achievement-card.locked .achievement-state { color: #b3a08a; }

@media (max-width: 640px) {
    .modal { padding: 12px; }
    .modal-content { max-height: 88vh; }
    .lb-summary { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .lb-stat b { font-size: 18px; }
    .achievements-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}
