* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.classroom {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 70%, #8FBC8F 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* 黑板样式 */
.blackboard {
    position: relative;
    width: 80%;
    max-width: 800px;
    height: 300px;
    background: #2C3E50;
    border: 15px solid #8B4513;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    overflow: hidden;
}

.blackboard-frame {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #34495E 0%, #2C3E50 50%, #34495E 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.chalk-holder {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 8px;
    background: #8B4513;
    border-radius: 4px;
}

.code-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    color: #00FF00;
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 20px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.code-line {
    margin: 5px 0;
}

.highlight {
    background: #FFD700;
    color: #000;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.7; }
}

.question-text {
    color: #FFFFFF;
    font-size: 16px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* 课桌样式 */
.desk {
    position: relative;
    width: 400px;
    height: 200px;
    background: #8B4513;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.paper {
    position: relative;
    width: 300px;
    height: 150px;
    background: #FFFFFF;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.paper-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        transparent,
        transparent 24px,
        #E0E0E0 24px,
        #E0E0E0 25px
    );
    pointer-events: none;
}

.answer-area {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#answer-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #4CAF50;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
    background: transparent;
    outline: none;
    transition: border-color 0.3s ease;
}

#answer-input:focus {
    border-color: #FF9800;
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.3);
}

#submit-btn {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#submit-btn:hover {
    background: #45a049;
}

#submit-btn:active {
    transform: translateY(1px);
}

.pen {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 4px;
    height: 60px;
    background: linear-gradient(to bottom, #FF0000, #800000);
    border-radius: 2px;
    transform: rotate(15deg);
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.pen::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -1px;
    width: 6px;
    height: 8px;
    background: #FFD700;
    border-radius: 3px;
}

.pencil-case {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 40px;
    height: 15px;
    background: #FF6B6B;
    border-radius: 7px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 红旗计数区域 */
.flag-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.flag-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flag-label {
    font-weight: bold;
    color: #333;
}

.flags {
    display: flex;
    gap: 5px;
}

.flag {
    width: 20px;
    height: 15px;
    background: #FF0000;
    position: relative;
    border-radius: 2px;
    animation: wave 2s ease-in-out infinite;
}

.flag::after {
    content: '';
    position: absolute;
    left: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 8px solid #8B4513;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(5deg); }
}

.score-display {
    font-size: 18px;
    font-weight: bold;
    color: #2E7D32;
}

/* 反馈区域 */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feedback.show {
    opacity: 1;
}

.feedback-content {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.feedback-icon {
    font-size: 48px;
    animation: bounce 0.6s ease;
}

.feedback-text {
    font-size: 18px;
    font-weight: bold;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* 游戏控制区域 */
.game-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
}

.game-controls button {
    padding: 12px 24px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.game-controls button:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.game-controls button:active {
    transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .classroom {
        padding: 10px;
    }
    
    .blackboard {
        width: 95%;
        height: 250px;
    }
    
    .code-display {
        font-size: 14px;
        padding: 15px;
    }
    
    .desk {
        width: 90%;
        max-width: 350px;
    }
    
    .paper {
        width: 90%;
    }
    
    .flag-counter {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 20px;
    }
    
    .game-controls {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin-top: 20px;
    }
}

