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

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 导航样式 ===== */
.page-header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
}

.page-header h1 {
    text-align: center;
    margin-bottom: 15px;
    color: #2c3e50;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    gap: 20px;
}

.main-nav a {
    text-decoration: none;
    color: #555;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.main-nav a:hover, .main-nav a.active {
    color: #ff9900;
    background-color: rgba(255, 153, 0, 0.1);
}

/* ===== 动画定义 ===== */
@keyframes float {
    0% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
    100% {
        transform: translateY(0) rotate(0deg);
    }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

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

/* ===== Stage: Baby (index.html) ===== */
.baby-stage {
    font-family: 'Comic Sans MS', cursive;
    background-color: #ffe6f2; /* 粉蜡笔色调 */
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.floating-letters {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.floating-letter {
    position: absolute;
    font-size: 4rem;
    color: rgba(255, 102, 178, 0.3);
    animation: float 6s infinite ease-in-out;
}

.floating-letter:nth-child(1) {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.floating-letter:nth-child(2) {
    top: 30%;
    left: 80%;
    animation-delay: 1s;
}

.floating-letter:nth-child(3) {
    top: 70%;
    left: 15%;
    animation-delay: 2s;
}

.floating-letter:nth-child(4) {
    top: 40%;
    left: 60%;
    animation-delay: 3s;
}

.floating-letter:nth-child(5) {
    top: 80%;
    left: 70%;
    animation-delay: 4s;
}

.welcome-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    position: relative;
    z-index: 2;
}

.welcome-title {
    font-size: 3rem;
    color: #ff66b2;
    margin-bottom: 20px;
    opacity: 0;
    animation: fadeIn 2s forwards;
    animation-delay: 1s;
}

.welcome-text {
    font-size: 2rem;
    color: #9966cc;
    margin-bottom: 40px;
    opacity: 0;
    animation: fadeIn 2s forwards;
    animation-delay: 3s;
}

.start-button {
    font-family: 'Comic Sans MS', cursive;
    font-size: 1.8rem;
    padding: 15px 30px;
    background-color: #ff9900;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.start-button:hover {
    background-color: #ff6600;
    transform: scale(1.1);
    animation: shake 0.5s;
}

.stats-footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
}

/* ===== Stage: Kid (journey.html - 上半段) ===== */
.journey-page {
    background-color: #f0f8ff; /* 淡蓝色背景 */
}

.kid-stage {
    padding: 40px 0;
    background: linear-gradient(135deg, #e0f7fa, #b3e5fc); /* Pastel 渐变 */
    border-radius: 20px;
    margin-bottom: 40px;
}

.section-title {
    text-align: center;
    font-size: 2.2rem;
    color: #3f51b5;
    margin-bottom: 30px;
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background-color: #3f51b5;
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 50px;
}

.timeline-item::after {
    content: attr(data-level);
    position: absolute;
    top: 0;
    left: 50%;
    width: 40px;
    height: 40px;
    background-color: #3f51b5;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transform: translateX(-50%);
    z-index: 1;
}

.timeline-content {
    position: relative;
    width: calc(50% - 40px);
    padding: 20px;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.timeline-item:nth-child(odd) .timeline-content {
    margin-left: auto;
    transform: translateX(20px);
}

.timeline-item:nth-child(even) .timeline-content {
    transform: translateX(-20px);
}

.timeline-content:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.level-title {
    font-size: 1.5rem;
    color: #3f51b5;
    margin-bottom: 10px;
}

.fun-sentence {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 15px;
    font-style: italic;
}

.memory-photo img {
    width: 100%;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.memory-photo img:hover {
    transform: scale(1.03);
}

/* ===== Stage: Teen (journey.html - 下半段) ===== */
.teen-stage {
    padding: 40px 0;
    background-color: #e8f5e9; /* 淡绿色背景 */
    border-radius: 20px;
}

.teen-stage .timeline-content {
    background-color: #4caf50; /* 更饱和的扁平色 */
    color: white;
}

.teen-stage .level-title {
    color: white;
}

.teen-stage .fun-sentence {
    color: rgba(255, 255, 255, 0.9);
}

.teen-stage .timeline::before {
    background-color: #2e7d32;
}

.teen-stage .timeline-item::after {
    background-color: #2e7d32;
}

/* 进度条样式 */
.progress-container {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.3s;
}

.progress-text {
    transform: rotate(90deg);
    font-size: 16px;
    font-weight: bold;
    fill: #ff9900;
}

/* ===== Stage: Fluent (games.html & gallery.html) ===== */
.games-page, .gallery-page {
    font-family: 'Fira Sans', sans-serif;
    background-color: #f5f5f5;
}

/* Games Page Styles */
.games-intro {
    text-align: center;
    margin-bottom: 40px;
}

.games-intro h2 {
    color: #1a237e; /* 深蓝色 */
    font-size: 2.2rem;
    margin-bottom: 15px;
}

.games-intro p {
    color: #555;
    font-size: 1.1rem;
}

.games-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media (min-width: 768px) {
    .games-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

.game-section {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.game-title {
    color: #1a237e;
    font-size: 1.5rem;
    margin-bottom: 10px;
    border-bottom: 2px solid #ff9900; /* 亮橙色边框 */
    padding-bottom: 8px;
}

.game-description {
    color: #555;
    margin-bottom: 20px;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.game-button, .quiz-button, .submit-button {
    background-color: #1a237e;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-family: 'Fira Sans', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-button:hover, .quiz-button:hover, .submit-button:hover {
    background-color: #ff9900;
}

.game-button:disabled, .quiz-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.game-score {
    font-weight: bold;
    color: #1a237e;
}

/* Memory Game Styles */
.memory-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.memory-card {
    aspect-ratio: 1;
    background-color: #1a237e;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease;
    transform-style: preserve-3d;
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

.memory-card .front, .memory-card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
}

.memory-card .front {
    background-color: #1a237e;
}

.memory-card .back {
    background-color: white;
    transform: rotateY(180deg);
}

.memory-card img {
    max-width: 80%;
    max-height: 80%;
}

/* Sentence Builder Styles */
.sentence-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background-color: #e8eaf6;
    border-radius: 5px;
    min-height: 80px;
}

.draggable-word {
    background-color: #1a237e;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: move;
    user-select: none;
    transition: all 0.2s ease;
}

.draggable-word:hover {
    background-color: #ff9900;
    transform: scale(1.05);
}

.sentence-builder-area {
    min-height: 100px;
    padding: 15px;
    background-color: #f5f5f5;
    border: 2px dashed #1a237e;
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.sentence-slot {
    height: 40px;
    min-width: 100px;
    border-bottom: 2px solid #1a237e;
    margin: 0 5px;
    display: inline-block;
}

/* Quiz Styles */
.quiz-container {
    display: none;
}

.quiz-question {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #1a237e;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.quiz-option {
    padding: 10px 15px;
    background-color: #e8eaf6;
    border: 2px solid #c5cae9;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-option:hover {
    background-color: #c5cae9;
}

.quiz-option.selected {
    background-color: #1a237e;
    color: white;
    border-color: #1a237e;
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
}

.quiz-result {
    text-align: center;
}

.quiz-result h4 {
    font-size: 1.5rem;
    color: #1a237e;
    margin-bottom: 20px;
}

#certificate-canvas {
    max-width: 100%;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Fireworks Animation */
.fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.firework {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    animation: explode 1s forwards;
}

@keyframes explode {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y));
        opacity: 0;
    }
}

/* Gallery Page Styles */
.message-section {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 40px;
}

.message-section h2 {
    color: #1a237e;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.message-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: 'Fira Sans', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus, .form-group textarea:focus {
    border-color: #1a237e;
    outline: none;
}

.gallery-section {
    padding: 20px 0;
}

.gallery-section h2 {
    color: #1a237e;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.gallery-masonry {
    column-count: 1;
    column-gap: 20px;
}

@media (min-width: 576px) {
    .gallery-masonry {
        column-count: 2;
    }
}

@media (min-width: 992px) {
    .gallery-masonry {
        column-count: 3;
    }
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: filter 0.3s ease;
}

.gallery-item:hover img {
    filter: brightness(0.8);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(26, 35, 126, 0.8);
    color: white;
    padding: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    transform: translateY(0);
}

/* 响应式调整 */
@media (max-width: 767px) {
    .timeline::before {
        left: 30px;
    }
    
    .timeline-item::after {
        left: 30px;
    }
    
    .timeline-content {
        width: calc(100% - 60px);
        margin-left: 60px !important;
        transform: none !important;
    }
    
    .games-container {
        grid-template-columns: 1fr;
    }
}