/* 基礎設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 返回主頁按鈕 */
.back-to-home-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    font-size: 0.95em;
    box-shadow: 0 4px 15px rgba(132, 250, 176, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-home-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(132, 250, 176, 0.6);
    background: linear-gradient(135deg, #8fd3f4 0%, #84fab0 100%);
}

body {
    font-family: 'Microsoft YaHei', 'PingFang TC', sans-serif;
    background: linear-gradient(to bottom, #E8F5E9 0%, #C8E6C9 50%, #A5D6A7 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* 角落花朵裝飾 - 不擋住作答區 */
body::before {
    content: '🌸🌼🌻';
    position: fixed;
    bottom: 20px;
    left: 20px;
    font-size: 3rem;
    z-index: 0;
    opacity: 0.7;
}

body::after {
    content: '🌻🌼🌸';
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 3rem;
    z-index: 0;
    opacity: 0.7;
}

/* 頁面切換 */
.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.page.active {
    display: block;
}

/* 主頁樣式 */
.container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 60px 20px;
}

.main-title {
    font-size: 3.5rem;
    color: #2E7D32;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    animation: titleBounce 2s ease-in-out infinite;
}

@keyframes titleBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.flowers-decoration {
    font-size: 3rem;
    margin: 30px 0;
}

.flower {
    display: inline-block;
    margin: 0 15px;
    animation: flowerSpin 3s ease-in-out infinite;
}

.flower:nth-child(1) {
    animation-delay: 0s;
}

.flower:nth-child(2) {
    animation-delay: 0.5s;
}

.flower:nth-child(3) {
    animation-delay: 1s;
}

@keyframes flowerSpin {

    0%,
    100% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.2);
    }
}

.question-selector {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 50px;
}

.select-btn {
    background: linear-gradient(135deg, #FFB6C1 0%, #FF69B4 100%);
    border: none;
    border-radius: 25px;
    padding: 25px 50px;
    font-size: 1.8rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 105, 180, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.select-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 105, 180, 0.5);
}

.select-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.btn-icon {
    font-size: 2rem;
}

/* 遊戲頁面 */
.header {
    padding: 15px;
    position: relative;
    z-index: 10;
}

.home-btn {
    background: linear-gradient(135deg, #87CEEB 0%, #4FC3F7 100%);
    border: none;
    border-radius: 15px;
    padding: 12px 25px;
    font-size: 1.1rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.3);
    transition: all 0.3s ease;
    font-weight: bold;
}

.home-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(79, 195, 247, 0.5);
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.question-area {
    margin-bottom: 40px;
}

.sound-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.sound-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border: none;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
}

.sound-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
}

.sound-btn:active {
    transform: scale(0.95);
}

.speaker-icon {
    animation: soundPulse 1.5s ease-in-out infinite;
}

@keyframes soundPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.meaning-feedback-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
}

.chinese-meaning {
    font-size: 2rem;
    color: #E91E63;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.answer-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 80px;
    align-items: center;
    flex-wrap: wrap;
}

.answer-box {
    width: 60px;
    height: 70px;
    border: 3px solid #4CAF50;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: #2E7D32;
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.answer-box.filled {
    background: linear-gradient(135deg, #C8E6C9 0%, #A5D6A7 100%);
    transform: scale(1.05);
}

.feedback-icon {
    font-size: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    animation: feedbackPop 0.5s ease;
}

@keyframes feedbackPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.letter-selection {
    margin: 40px 0;
}

.letters-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.letter-btn {
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    border: 3px solid #9C27B0;
    border-radius: 15px;
    padding: 20px;
    font-size: 1.8rem;
    font-weight: bold;
    color: #6A1B9A;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.2);
}

.letter-btn:hover:not(:disabled) {
    transform: translateY(-5px);
    background: linear-gradient(135deg, #E1BEE7 0%, #CE93D8 100%);
    box-shadow: 0 6px 18px rgba(156, 39, 176, 0.4);
}

.letter-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.action-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.action-btn {
    border: none;
    border-radius: 20px;
    padding: 18px 40px;
    font-size: 1.3rem;
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.clear-btn {
    background: linear-gradient(135deg, #FF6B6B 0%, #EE5A6F 100%);
}

.clear-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.submit-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45A049 100%);
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4);
}

.backspace-btn {
    background: linear-gradient(135deg, #D1C4E9 0%, #B39DDB 100%);
}

.backspace-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(179, 157, 219, 0.4);
}

.stats-area {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 3px dashed #4CAF50;
}

.stat-item {
    background: linear-gradient(135deg, #fff 0%, #f5f5f5 100%);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.stat-label {
    display: block;
    font-size: 1rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #2E7D32;
}

.stat-item.correct .stat-value {
    color: #4CAF50;
}

.stat-item.wrong .stat-value {
    color: #F44336;
}

.stat-item.score .stat-value {
    color: #2196F3;
}

.stat-item.points .stat-value {
    color: #FF9800;
}

/* 錯題加強頁面 */
.review-container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.review-title {
    font-size: 2.5rem;
    color: #E91E63;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.final-stats {
    display: block;
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #FFF9C4 0%, #FFEB3B 100%);
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(255, 235, 59, 0.3);
}

.final-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.final-stat-item {
    text-align: center;
    padding: 15px;
}

.final-stat-label {
    display: block;
    font-size: 1.3rem;
    color: #F57C00;
    font-weight: bold;
    margin-bottom: 8px;
}

.final-stat-value {
    display: block;
    font-size: 2.2rem;
    font-weight: bold;
    color: #E65100;
}

.review-button-area {
    text-align: center;
    padding: 40px 20px;
    margin: 30px 0;
}

.review-hint {
    font-size: 1.5rem;
    color: #666;
    margin-bottom: 25px;
}

.start-review-btn {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    border: none;
    border-radius: 25px;
    padding: 20px 50px;
    font-size: 1.6rem;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 152, 0, 0.4);
    transition: all 0.3s ease;
    font-weight: bold;
}

.start-review-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 152, 0, 0.6);
}

.start-review-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.review-progress {
    text-align: center;
    font-size: 1.5rem;
    color: #E91E63;
    font-weight: bold;
    margin-bottom: 30px;
    padding: 15px;
    background: linear-gradient(135deg, #FFE0E9 0%, #FFC1D5 100%);
    border-radius: 15px;
}

.review-practice-area {
    margin-top: 30px;
}

.review-stats-area {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 3px dashed #E91E63;
}

.review-complete {
    text-align: center;
    padding: 60px 20px;
}

.review-complete h3 {
    font-size: 2.5rem;
    color: #4CAF50;
    margin: 20px 0;
}

.review-complete-stats {
    font-size: 1.5rem;
    color: #666;
    margin-top: 20px;
}

.review-complete-stats p {
    margin: 10px 0;
}

.no-wrong-message {
    text-align: center;
    font-size: 2rem;
    color: #4CAF50;
    padding: 40px;
}

.celebration-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .letters-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .stats-area {
        grid-template-columns: repeat(2, 1fr);
    }

    .final-stats {
        grid-template-columns: 1fr;
    }

    .game-container,
    .review-container {
        padding: 20px;
    }
}