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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-min-height: calc(100vh - 60px );
    overflow: hidden;
}

.app-layout {
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 60px );
    display: flex;
    background: white;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
}

/* 左侧：AI老师区域 */
.teacher-side {
    width: 300px;
    background: linear-gradient(135deg, #1E90FF 0%, #4169E1 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
}

.teacher-character {
    width: 200px;
    height: 200px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 20px;
}

#teacherCanvas {
    display: block;
}

.teacher-label {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 右侧：对话区域 */
.conversation-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    gap: 20px;
}

/* AI输出框 */
.ai-output-box {
    flex: 1;
    background: #e3f2fd;
    border-radius: 20px;
    padding: 20px;
    border: 3px solid #1E90FF;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(30, 144, 255, 0.2);
}

.box-label {
    font-size: 14px;
    font-weight: bold;
    color: #1E90FF;
    margin-bottom: 10px;
}

.output-content {
    flex: 1;
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border-radius: 10px;
}

/* 用户输入框 */
.user-input-box {
    flex: 1;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 20px;
    border: 3px solid #9e9e9e;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.user-input-box .box-label {
    color: #666;
}

.input-content {
    flex: 1;
    font-size: 16px;
    line-height: 1.8;
    color: #666;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border-radius: 10px;
}

/* 控制区域 */
.control-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.record-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #1E90FF, #4169E1);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(30, 144, 255, 0.4);
}

.record-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 144, 255, 0.5);
}

.record-button:active {
    transform: translateY(0);
}

.mic-icon {
    width: 28px;
    height: 28px;
}

.recording-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #d32f2f;
    font-weight: bold;
    font-size: 16px;
}

.recording-indicator.active {
    display: flex;
}

.pulse {
    width: 14px;
    height: 14px;
    background: #d32f2f;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

.language-buttons {
    display: flex;
    gap: 10px;
}

.lang-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #1E90FF;
    background: white;
    color: #1E90FF;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.lang-btn.active {
    background: #1E90FF;
    color: white;
    box-shadow: 0 4px 15px rgba(30, 144, 255, 0.3);
}

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

/* Loading */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 18px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    
    .teacher-side {
        width: 100%;
        height: 200px;
        flex-direction: row;
        padding: 20px;
        justify-content: flex-start;
    }
    
    .teacher-character {
        width: 120px;
        height: 120px;
        margin-bottom: 0;
        margin-right: 20px;
    }
    
    #teacherCanvas {
        width: 120px;
        height: 120px;
    }
    
    .teacher-label {
        font-size: 20px;
    }
    
    .conversation-side {
        padding: 20px;
        gap: 15px;
    }
    
    .ai-output-box,
    .user-input-box {
        min-height: 120px;
    }
    
    .output-content,
    .input-content {
        font-size: 14px;
    }
    
    .record-button {
        padding: 15px;
        font-size: 16px;
    }
    
    .lang-btn {
        padding: 10px;
        font-size: 14px;
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: calc(100vh - 60px );
    }
    
    .container {
        height: auto;
        min-min-height: calc(100vh - 60px );
        padding: 10px;
        overflow-y: visible;
    }
    
    .voice-button {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    
    .chat-container {
        margin-bottom: 100px;
        max-height: none;
    }
}

/* Unlock Prompt Overlay for Mobile */
.unlock-prompt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

.unlock-prompt-content {
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 85%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease;
}

.unlock-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

.unlock-prompt-content h3 {
    color: #333;
    font-size: 20px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.unlock-prompt-content p {
    color: #666;
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Mobile Unlock Overlay - 移动端音频解锁提示 */
.mobile-unlock-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

.mobile-unlock-content {
    background: white;
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 85%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease;
}

.mobile-unlock-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

.mobile-unlock-content h3 {
    color: #333;
    font-size: 20px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.mobile-unlock-content p {
    color: #666;
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
}

/* AI老师内容区域滚动 */
.left-panel {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 20px;
}

.left-panel .ai-content {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 10px;
}

/* 美化滚动条 */
.left-panel .ai-content::-webkit-scrollbar {
    width: 8px;
}

.left-panel .ai-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.left-panel .ai-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.left-panel .ai-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* AI输出框滚动 - 强制应用 */
.ai-output-box {
    max-height: 50vh !important;
    overflow-y: auto !important;
}

.ai-output-box .output-content {
    max-height: 45vh !important;
    overflow-y: auto !important;
}

/* 语言选择器样式 */
.language-selector {
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.language-selector h3 {
    color: white !important;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px !important;
}

.language-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.language-option {
    background: white;
    border: 3px solid transparent;
    border-radius: 12px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.language-option:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.3);
}

.language-option .flag {
    font-size: 48px;
    line-height: 1;
}

.language-option .lang-name {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.language-option .lang-cn {
    font-size: 14px;
    color: #7f8c8d;
}

/* 课程内容样式 */
.lesson-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    margin: -20px -20px 20px -20px;
}

.lesson-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

.lesson-category {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.lesson-content {
    line-height: 1.8;
    font-size: 16px;
    color: #2c3e50;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .language-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .language-option {
        padding: 15px 10px;
    }
    
    .language-option .flag {
        font-size: 36px;
    }
    
    .language-option .lang-name {
        font-size: 16px;
    }
}

/* ========== 语言选择卡片优化 ========== */
/* 覆盖原有样式,使5个卡片在一行显示 */

.language-card {
    background: white;
    border-radius: 16px;
    padding: 20px 15px !important;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 120px !important;
    max-width: 150px !important;
    flex: 0 1 auto !important;
}

.language-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.language-card .flag {
    font-size: 2.5rem !important;
    margin-bottom: 8px !important;
}

.language-card .language-code {
    font-size: 1.5rem !important;
    font-weight: bold;
    color: #333;
    margin-bottom: 4px !important;
}

.language-card .language-name {
    font-size: 0.95rem !important;
    color: #666;
    margin-bottom: 2px !important;
}

.language-card .language-name-cn {
    font-size: 0.85rem !important;
    color: #999;
}

.language-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
    justify-content: center !important;
    max-width: 900px !important;
    margin: 0 auto !important;
}

@media (max-width: 768px) {
    .language-grid {
        gap: 10px !important;
    }
    
    .language-card {
        min-width: 100px !important;
        max-width: 120px !important;
        padding: 15px 10px !important;
    }
    
    .language-card .flag {
        font-size: 2rem !important;
    }
    
    .language-card .language-code {
        font-size: 1.2rem !important;
    }
}

