/* ========================================
   Lucky Red Panda - 全局样式
   ======================================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    margin: 0;
    padding: 20px;
    background-color: #fffaf0;
    color: #333;
}

h1 {
    color: #d32f2f;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* ========================================
   通用应用容器样式
   ======================================== */

.app-container {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(211, 47, 47, 0.15);
    width: 90%;
    max-width: 500px;
    text-align: center;
    margin: 20px auto;
    border: 2px solid #ffcdd2;
}

.app-container h2 {
    color: #d32f2f;
    margin-top: 0;
    font-size: 1.5rem;
}

/* ========================================
   统计栏
   ======================================== */

.stats-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #666;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
}

.stat-item strong {
    color: #d32f2f;
    font-size: 1.1rem;
}

/* ========================================
   问题显示区域
   ======================================== */

.question-box {
    font-size: 2.5rem;
    font-weight: bold;
    margin: 20px 0;
    color: #2c3e50;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.number-card {
    background: #d32f2f;
    color: white;
    width: 50px;
    height: 50px;
    line-height: 50px;
    border-radius: 8px;
    display: inline-block;
    font-size: 1.8rem;
    box-shadow: 0 4px 0 #b71c1c;
    user-select: none;
}

.question-area {
    margin: 20px 0;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.emoji-display {
    font-size: 3.5rem;
    margin-bottom: 10px;
    letter-spacing: 10px;
}

.text-question {
    font-size: 1.4rem;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1.6;
}

.fill-blank {
    font-size: 1.8rem;
    letter-spacing: 5px;
    color: #d32f2f;
}

.blank-space {
    display: inline-block;
    width: 40px;
    border-bottom: 3px solid #d32f2f;
    color: #d32f2f;
    text-align: center;
}

/* ========================================
   输入框
   ======================================== */

input[type="text"],
input[type="number"] {
    width: 90%;
    padding: 15px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.3s;
    font-family: 'Courier New', Courier, monospace;
}

input:focus {
    border-color: #d32f2f;
}

input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* ========================================
   按钮
   ======================================== */

.controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

button {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    font-weight: bold;
}

button:active {
    transform: scale(0.95);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-submit {
    background-color: #d32f2f;
    color: white;
    flex: 2;
}

.btn-check {
    background-color: #27ae60;
    color: white;
    flex: 2;
}

.btn-skip {
    background-color: #95a5a6;
    color: white;
    flex: 1;
}

/* ========================================
   模式选择器
   ======================================== */

.mode-selector {
    margin-bottom: 20px;
}

select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

/* ========================================
   反馈区域
   ======================================== */

.feedback {
    min-height: 80px;
    margin-top: 15px;
    font-weight: bold;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
    line-height: 1.5;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 10px;
    word-break: break-all;
}

.feedback.show {
    opacity: 1;
}

.feedback.correct {
    color: #27ae60;
    background-color: #e8f8f5;
    border: 1px solid #27ae60;
}

.feedback.wrong {
    color: #c0392b;
    background-color: #fdedec;
    border: 1px solid #c0392b;
}

.feedback.hint {
    color: #d35400;
    font-size: 0.95rem;
}

.explanation {
    font-size: 0.9rem;
    color: #555;
    font-weight: normal;
    margin-top: 5px;
    display: block;
    text-align: left;
}

.hint-text {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 5px;
    font-weight: normal;
}

/* ========================================
   动画效果
   ======================================== */

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

.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.pop {
    animation: pop 0.3s ease-out;
}

/* ========================================
   代码思维教学模块样式
   ======================================== */

.coding-kids-container {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.15);
    width: 90%;
    max-width: 600px;
    text-align: center;
    margin: 20px auto;
    border: 2px solid #aed6f1;
}

.coding-kids-container h2 {
    color: #2980b9;
    margin-top: 0;
    font-size: 1.5rem;
}

.lesson-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
}

.lesson-card h3 {
    margin-top: 0;
    font-size: 1.3rem;
}

.lesson-card p {
    font-size: 1rem;
    line-height: 1.6;
}

.code-block {
    background-color: #2d3436;
    color: #dfe6e9;
    padding: 15px;
    border-radius: 10px;
    text-align: left;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    margin: 15px 0;
    overflow-x: auto;
    border: 2px solid #636e72;
}

.code-block .keyword {
    color: #fd79a8;
}

.code-block .string {
    color: #55efc4;
}

.code-block .number {
    color: #74b9ff;
}

.code-block .comment {
    color: #b2bec3;
}

.interactive-area {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
}

.interactive-area textarea {
    width: 100%;
    min-height: 100px;
    padding: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    resize: vertical;
}

.output-area {
    background: #2d3436;
    color: #55efc4;
    padding: 15px;
    border-radius: 10px;
    text-align: left;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    min-height: 60px;
    margin-top: 10px;
    white-space: pre-wrap;
}

.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    height: 20px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    margin: 5px;
}

.badge-easy {
    background: #27ae60;
    color: white;
}

.badge-medium {
    background: #f39c12;
    color: white;
}

.badge-hard {
    background: #e74c3c;
    color: white;
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.nav-buttons button {
    flex: 1;
    margin: 0 5px;
}

.btn-prev {
    background-color: #95a5a6;
    color: white;
}

.btn-next {
    background-color: #3498db;
    color: white;
}

.btn-run {
    background-color: #27ae60;
    color: white;
    width: 100%;
    margin-top: 10px;
}

/* ========================================
   动态画廊模块样式
   ======================================== */

.gallery-container {
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 900px;
    margin: 40px auto;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.gallery-main {
    position: relative;
    background: #000;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-main-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.gallery-main-img:hover {
    transform: scale(1.02);
}

.gallery-main-img.loading {
    opacity: 0.5;
}

/* 导航按钮 */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

/* 画廊信息栏 */
.gallery-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.gallery-caption {
    font-size: 1.1rem;
    color: #333;
    font-weight: 500;
}

.gallery-caption-text {
    color: #d32f2f;
}

.gallery-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.gallery-counter {
    font-size: 0.9rem;
    color: #666;
    background: #fff;
    padding: 5px 12px;
    border-radius: 15px;
    border: 1px solid #ddd;
}

.gallery-play {
    background: #d32f2f;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.gallery-play:hover {
    background: #b71c1c;
    transform: scale(1.05);
}

.gallery-play.playing {
    background: #27ae60;
}

/* 缩略图区域 */
.gallery-thumbnails {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #fafafa;
    overflow-x: auto;
    justify-content: center;
    flex-wrap: wrap;
}

.gallery-thumb {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s;
    flex-shrink: 0;
}

.gallery-thumb:hover {
    transform: scale(1.05);
}

.gallery-thumb.active {
    border-color: #d32f2f;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 灯箱（全屏查看） */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-img {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-caption {
    color: white;
    font-size: 1.2rem;
    margin-top: 20px;
    text-align: center;
    padding: 0 20px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.lightbox-close:hover {
    transform: scale(1.2);
    color: #d32f2f;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 2rem;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .gallery-main {
        height: 300px;
    }

    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .gallery-prev {
        left: 10px;
    }

    .gallery-next {
        right: 10px;
    }

    .gallery-info {
        flex-direction: column;
        gap: 10px;
    }

    .gallery-thumb {
        width: 60px;
        height: 60px;
    }

    .lightbox-nav {
        padding: 15px 10px;
        font-size: 1.5rem;
    }
}

/* ========================================
   页脚样式
   ======================================== */

footer {
    margin-top: 50px;
    font-size: 0.8rem;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

footer a {
    color: #666;
    text-decoration: none;
    margin: 0 5px;
}

/* ========================================
   Tab 导航样式
   ======================================== */
.tab-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 30px 0;
    padding: 0 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 30px;
    border: 2px solid #C41E3A;
    background: #fff;
    color: #C41E3A;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.tab-btn:hover {
    background: #C41E3A;
    color: #fff;
}

.tab-btn.active {
    background: #C41E3A;
    color: #fff;
}

/* ========================================
   中文副标题
   ======================================== */
.chinese-subtitle {
    text-align: center;
    color: #666;
    font-size: 18px;
    margin-top: -10px;
    margin-bottom: 20px;
}

/* ========================================
   诗词模块样式
   ======================================== */
.poetry-app-container {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(211, 47, 47, 0.15);
    width: 90%;
    max-width: 600px;
    text-align: center;
    margin: 20px auto;
    border: 2px solid #ffcdd2;
}

.poetry-app-container h2 {
    color: #d32f2f;
    margin-top: 0;
    font-size: 1.5rem;
}

.poetry-display {
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    padding: 30px;
    border-radius: 15px;
    margin: 20px 0;
    border: 2px solid #ffcdd2;
}

.poetry-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: #C41E3A;
    margin-bottom: 10px;
}

.poetry-author {
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

.poetry-text {
    font-size: 1.3rem;
    line-height: 2;
    color: #2c3e50;
    font-family: 'KaiTi', 'STKaiti', serif;
}
