/* Duolingo Color Variables */
:root {
    --duo-green: #58CC02;
    --duo-green-dark: #46A302;
    --duo-green-darker: #3A8C02;
    --duo-blue: #1CB0F6;
    --duo-blue-dark: #1899D6;
    --duo-yellow: #FFC800;
    --duo-yellow-dark: #E6B000;
    --duo-orange: #FF9600;
    --duo-purple: #CE82FF;
    --duo-red: #FF4B4B;
    --duo-bg-light: #F7F7F7;
    --duo-text-dark: #3C3C3C;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    color: #2c3e50;
    height: 100vh;
    overflow: hidden;
}

/* Three-Panel Layout Container */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    position: relative;
}

.panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 200px;
    position: relative;
}

/* Panel initial sizes */
.left-panel {
    width: 30%;
}

.center-panel {
    width: 40%;
    flex-grow: 1;
}

.right-panel {
    width: 30%;
}

/* Two-Panel Mode Styles */
.app-container.two-panel-mode .center-panel {
    display: none;
}

.app-container.two-panel-mode .resize-handle {
    display: none;
}

.app-container.two-panel-mode .left-panel {
    width: 30%;
    min-width: 30%;
    max-width: 30%;
    flex-shrink: 0;
    flex-grow: 0;
    border-right: 1px solid #e0e0e0;
}

.app-container.two-panel-mode .right-panel {
    width: 70%;
    flex-grow: 1;
    flex-shrink: 0;
}

.app-container.two-panel-mode .left-panel .input-section {
    background: #f8f9fa;
    border-top: 2px solid #e0e0e0;
}

.app-container.two-panel-mode .input-section .prompt-input {
    background: #ffffff;
    color: #333333;
}

/* Resize Handles */
.resize-handle {
    width: 6px;
    height: 100vh;
    background: #e1e4e8;
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s ease;
    z-index: 10;
}

.resize-handle:hover {
    background: #8b949e;
}

.resize-handle:active {
    background: #6e7681;
}

/* Visual indicator on resize handle */
.resize-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1px;
}

/* LEFT PANEL - Lesson Content */
.left-panel {
    background: #ffffff;
    color: #333333;
    position: relative;
    border-right: 1px solid #e0e0e0;
}

.lesson-header {
    padding: 1.5rem 2rem;
    text-align: left;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
}

.lesson-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    outline: none;
}

.nav-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: scale(1.05);
}

.nav-btn:active:not(:disabled) {
    background: #e5e7eb;
    transform: scale(0.98);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.layout-toggle-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
}

.layout-toggle-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: scale(1.05);
}

.layout-toggle-btn:active {
    background: #e5e7eb;
    transform: scale(0.98);
}

.layout-toggle-btn .toggle-icon {
    transition: transform 0.3s ease;
}

.two-panel-mode .layout-toggle-btn .toggle-icon {
    transform: rotate(90deg);
}

.lesson-indicator {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
    padding: 0 0.5rem;
    min-width: 45px;
    justify-content: center;
}

.lesson-total {
    opacity: 0.7;
}

.logo {
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #4a90e2;
    color: white;
    border-radius: 4px;
}

.lesson-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    letter-spacing: 0.3px;
}

.tagline {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.lesson-progress {
    margin-top: 1rem;
}

.lesson-number {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.lesson-content {
    flex: 1;
    padding: 1rem 1.5rem;
    overflow-y: auto;
    background: white;
    line-height: 1.5;
}

.character-section {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: slideIn 0.6s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.character {
    font-size: 3rem;
    animation: wave 2s infinite;
    flex-shrink: 0;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.speech-bubble {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1rem;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 10px 0;
    border-color: transparent rgba(255, 255, 255, 0.15) transparent transparent;
}

.lesson-steps {
    margin-bottom: 2rem;
}

.lesson-steps h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lesson-steps {
    margin: 1.5rem 0;
}

.step-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.step-number {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    margin-bottom: 0.3rem;
    color: #667eea;
}

.step-content p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Step Progress Indicator */
.step-progress-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0 2rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.step-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.step-circle .step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.step-circle .step-label {
    font-size: 0.75rem;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.step-circle.active .step-num {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    animation: pulse 2s infinite;
}

.step-circle.active .step-label {
    opacity: 1;
    font-weight: 600;
    color: #667eea;
}

.step-circle.completed .step-num {
    background: #48bb78;
    color: white;
    border-color: #48bb78;
}

.step-circle.completed .step-num::before {
    content: '✓';
}

.step-circle.completed .step-label {
    opacity: 0.8;
    color: #48bb78;
}

.step-circle.locked .step-num {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

.step-circle.locked .step-label {
    opacity: 0.3;
}

.step-connector {
    width: 30px;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 5px;
    margin-bottom: 20px;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
    }
}

/* Individual Lesson Steps */
.lesson-step,
.lesson-challenge {
    display: none; /* Hide all steps by default */
}

.lesson-step.active-step,
.lesson-challenge.active-step {
    display: block; /* Show only active step */
}

.lesson-step {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid #667eea;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    transition: all 0.3s ease;
}

.lesson-step:hover {
    background: rgba(255, 255, 255, 0.08);
    border-left-color: #764ba2;
}

.step-header {
    margin-bottom: 1rem;
}

.step-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.step-header h3 {
    margin: 0.5rem 0 0 0;
    font-size: 1.3rem;
}

.step-description {
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.step-description p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.step-description strong {
    color: #667eea;
}

.step-prompt-example {
    margin-top: 1rem;
}

.step-prompt-example strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Challenge Enhancements */
.challenge-requirements h4,
.challenge-ideas h4,
.bonus-features h4 {
    color: #667eea;
    font-size: 1rem;
    margin: 1rem 0 0.5rem 0;
}

.challenge-requirements ul,
.bonus-features ul {
    list-style: none;
    padding: 0;
}

.challenge-requirements li,
.bonus-features li {
    padding: 0.5rem 0;
    padding-left: 0;
}

.challenge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.lesson-challenge {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 1.2rem;
    margin: 1.5rem 0;
}

.lesson-challenge h3 {
    color: #667eea;
    margin-bottom: 0.8rem;
}

.challenge-ideas {
    margin: 1rem 0;
}

.challenge-ideas ul {
    list-style: none;
    padding: 0;
}

.challenge-ideas li {
    padding: 0.4rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.challenge-ideas li:before {
    content: '';
    position: absolute;
    left: 0;
}

.challenge-examples {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

.current-lesson {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.suggestions-section h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.suggestion-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.suggestion-text {
    font-weight: 500;
}

/* New Lesson Format Styles */
.lesson-title {
    margin-bottom: 1rem;
    text-align: left;
}

.lesson-title h2 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lesson-subtitle {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-top: 0.5rem;
}

.lesson-duration {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.review-list {
    list-style: none;
    padding: 0;
    margin-top: 1rem;
}

.review-list li {
    padding: 0.5rem 0;
    padding-left: 2rem;
    position: relative;
    color: #333;
    line-height: 1.5;
    font-size: 0.9rem;
}

.review-list li::before {
    content: "•";
    position: absolute;
    left: 0.8rem;
    color: #333;
    font-weight: bold;
    font-size: 1.2rem;
}

.review-list li code {
    background: #f0f0f0;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #d73a49;
}

.lesson-objectives {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
}

.lesson-objectives h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    font-weight: 600;
}

.objectives-list {
    list-style: none;
    padding: 0;
}

.objectives-list li {
    padding: 0.6rem 0;
    padding-left: 1.8rem;
    position: relative;
    color: #555;
    line-height: 1.5;
}

.objectives-list li::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: #666;
    font-weight: bold;
}

.lesson-narrative {
    margin-bottom: 1rem;
}

.lesson-narrative h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    font-weight: 600;
}

.narrative-content {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e0e0e0;
}

.narrative-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
    color: #555;
}

.code-languages {
    margin-top: 1rem;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.lesson-instructions {
    margin-bottom: 1rem;
}

.lesson-instructions h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    font-weight: 600;
}

.instruction-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e0e0e0;
}

.instruction-box p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.challenge-examples {
    margin-top: 1rem;
}

.example-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.example-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.example-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.example-text {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.example-text strong {
    font-weight: 600;
    font-size: 1rem;
}

.example-text small {
    opacity: 0.8;
    font-size: 0.85rem;
}

.lesson-tip {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
}

.tip-icon {
    font-size: 1.5rem;
    color: #ff9800;
    flex-shrink: 0;
}

.tip-content {
    line-height: 1.5;
}

.tip-content strong {
    font-weight: 600;
}

/* CENTER PANEL - Code Editor */
.center-panel {
    background: #1e1e1e;
    color: #d4d4d4;
    border-right: 1px solid #333;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #252526;
    border-bottom: 1px solid #333;
}

.panel-header h3 {
    font-size: 1.1rem;
    color: #cccccc;
}

.panel-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.9rem;
}

.tab-btn.active,
.tab-btn:hover {
    background: #37373d;
    color: #cccccc;
}

.panel-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.progress-area {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.welcome-message {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.progress-message {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: #2d2d30;
    border-radius: 8px;
    border-left: 3px solid #007acc;
    animation: fadeInMessage 0.5s ease;
    line-height: 1.4;
}

.progress-message.system {
    border-left-color: #52c41a;
    background: #1b2b1f;
}

.progress-message.assistant {
    border-left-color: #722ed1;
    background: #2b1f30;
}

.progress-message.tool {
    border-left-color: #fa8c16;
    background: #2b2419;
}

.progress-message.success {
    border-left-color: #52c41a;
    background: #1b2b1f;
}

.progress-message.error {
    border-left-color: #ff4d4f;
    background: #2b1f1f;
}

.progress-text {
    flex: 1;
    word-wrap: break-word;
    font-size: 0.9rem;
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.progress-message.assistant .progress-icon {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.code-display {
    flex: 1;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 1.5rem;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-display::-webkit-scrollbar {
    width: 8px;
}

.code-display::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.code-display::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.code-display::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Cost Tracker Styles */
.cost-tracker-panel {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
    border: 1px solid #3a5a7f;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cost-tracker-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.cost-icon {
    font-size: 1.3rem;
}

.cost-tracker-header h5 {
    margin: 0;
    color: #f0f0f0;
    font-size: 0.9rem;
    font-weight: 600;
}

.cost-tracker-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.cost-stat {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.75rem;
    text-align: center;
}

.cost-label {
    font-size: 0.7rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.4rem;
}

.cost-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #4caf50;
    font-family: 'Fira Code', monospace;
}

.cost-value.cost-total {
    color: #64b5f6;
}

.cost-value.cost-high {
    color: #ff9800;
}

.cost-value.cost-very-high {
    color: #f44336;
}

.cost-tokens {
    font-size: 0.7rem;
    color: #888;
    margin-top: 0.3rem;
}

/* Backend Logs Styles */
.logs-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #2d2d30;
    border-bottom: 1px solid #333;
}

.logs-header h4 {
    margin: 0;
    color: #cccccc;
    font-size: 1rem;
}

.clear-logs-btn {
    background: #404040;
    color: #cccccc;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.clear-logs-btn:hover {
    background: #505050;
    border-color: #666;
}

.logs-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    background: #1e1e1e;
    color: #d4d4d4;
}

.log-placeholder {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    animation: logFadeIn 0.3s ease;
}

.log-entry.success {
    background: rgba(82, 196, 26, 0.1);
    border-left: 3px solid #52c41a;
}

.log-entry.error {
    background: rgba(255, 77, 79, 0.1);
    border-left: 3px solid #ff4d4f;
}

.log-entry.info {
    background: rgba(0, 122, 204, 0.1);
    border-left: 3px solid #007acc;
}

.log-entry.warning {
    background: rgba(250, 140, 22, 0.1);
    border-left: 3px solid #fa8c16;
}

.log-timestamp {
    color: #888;
    font-size: 0.75rem;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.log-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.log-message {
    flex: 1;
    word-wrap: break-word;
}

@keyframes logFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-section {
    background: #252526;
    border-top: 1px solid #333;
    padding: 1rem 1.5rem;
}

.environment-info {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
}

.env-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.environment-toggle {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #cccccc;
}

.toggle-checkbox {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 24px;
    background: #404040;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.toggle-checkbox:checked + .toggle-slider {
    background: linear-gradient(135deg, #007acc 0%, #005a9e 100%);
}

.toggle-checkbox:checked + .toggle-slider::before {
    transform: translateX(24px);
}

.toggle-text {
    font-weight: 500;
}

.input-container {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.prompt-input {
    flex: 1;
    background: #3c3c3c;
    border: 1px solid #555;
    border-radius: 8px;
    padding: 0.8rem;
    color: #ffffff;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    max-height: 150px;
}

.prompt-input:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.prompt-input::placeholder {
    color: #888;
}

.generate-btn {
    background: linear-gradient(135deg, #007acc 0%, #005a9e 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #005a9e 0%, #004578 100%);
    transform: translateY(-2px);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.1rem;
}

/* RIGHT PANEL - Live Preview */
.right-panel {
    background: white;
    border-left: 3px solid var(--duo-green);
}

/* Duolingo-style panel header for right panel */
.right-panel .panel-header {
    background: linear-gradient(135deg, var(--duo-green) 0%, var(--duo-green-dark) 100%);
    color: white;
    padding: 20px;
    border-bottom: none;
}

.right-panel .panel-header h3 {
    color: white;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preview-controls {
    display: flex;
    gap: 0.5rem;
}

/* Duolingo-style 3D Buttons */
.control-btn,
.duo-btn {
    background: white;
    border: 3px solid #E5E5E5;
    border-radius: 16px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 0 #E5E5E5;
    position: relative;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.control-btn:hover,
.duo-btn:hover {
    background: var(--duo-bg-light);
    transform: scale(1.05);
}

.control-btn:active,
.duo-btn:active {
    top: 2px;
    box-shadow: 0 2px 0 #E5E5E5;
}

/* Duolingo button variants */
.duo-btn-primary {
    background: var(--duo-blue);
    color: white;
    border-color: var(--duo-blue-dark);
    box-shadow: 0 4px 0 var(--duo-blue-dark);
}

.duo-btn-primary:hover {
    background: var(--duo-blue);
    filter: brightness(1.1);
}

.duo-btn-primary:active {
    box-shadow: 0 2px 0 var(--duo-blue-dark);
}

.duo-btn-secondary {
    background: var(--duo-yellow);
    color: var(--duo-text-dark);
    border-color: var(--duo-yellow-dark);
    box-shadow: 0 4px 0 var(--duo-yellow-dark);
}

.duo-btn-secondary:hover {
    background: var(--duo-yellow);
    filter: brightness(1.1);
}

.duo-btn-secondary:active {
    box-shadow: 0 2px 0 var(--duo-yellow-dark);
}

.preview-container {
    margin: 20px;
    height: calc(100% - 120px);
    background: white;
    border: 4px solid var(--duo-green);
    border-radius: 24px;
    box-shadow: 0 8px 0 rgba(88, 204, 2, 0.2);
    overflow: hidden;
    position: relative;
}

.preview-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #F0FFF4 0%, #E0F7FA 100%);
    animation: gentle-pulse 3s ease-in-out infinite;
}

.placeholder-content {
    text-align: center;
    color: #6a737d;
}

.placeholder-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.placeholder-content p {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.placeholder-content small {
    font-size: 0.9rem;
    opacity: 0.7;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    border-radius: 24px;
}

.preview-frame.loaded {
    animation: preview-celebrate 0.5s ease-out;
}

/* Duolingo-style Animations */
@keyframes gentle-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes preview-celebrate {
    0% { transform: scale(0.95); opacity: 0; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes celebrate {
    0% { transform: scale(0) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* Character/Icon animations */
.duo-character {
    animation: bounce 2s ease-in-out infinite;
}

.encouragement-badge {
    background: var(--duo-green);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    margin-top: 16px;
    font-weight: 700;
    display: inline-block;
    box-shadow: 0 4px 0 var(--duo-green-dark);
}

/* Success Confirmation Bar - Duolingo Style */
.success-confirmation-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--duo-green) 0%, var(--duo-green-dark) 100%);
    border-top: none;
    padding: 2.5rem 3rem;
    box-shadow: 0 -8px 24px rgba(88, 204, 2, 0.3);
    z-index: 1000;
    animation: slideUpIn 0.5s ease-out;
}

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

.success-content {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 3rem;
}

.success-message {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.success-icon {
    font-size: 48px;
    animation: celebrate 0.6s ease-out;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

.success-text {
    font-size: 2.8rem;
    font-weight: 700;
    color: #1a1a1a;
}

.xp-reward {
    font-size: 1.6rem;
    font-weight: 600;
    color: #2d7a0e;
    padding: 0.3rem 0.8rem;
    background: rgba(82, 196, 26, 0.15);
    border-radius: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.success-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.why-btn {
    background: #f5f5f5;
    color: #666;
    border: 2px solid #ddd;
    padding: 0.8rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.why-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.continue-btn {
    background: white;
    color: var(--duo-green);
    border: none;
    border-radius: 16px;
    padding: 14px 32px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
    position: relative;
    top: 0;
    min-width: 140px;
}

.continue-btn:hover {
    transform: scale(1.05);
}

.continue-btn:active {
    top: 2px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

/* Code Snippet Styling */
.code-snippet {
    display: block;
    background: #f0f0f0;
    padding: 0.8rem;
    border-radius: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: #d73a49;
    margin: 1rem 0;
    border-left: 3px solid #007acc;
}

/* Save Indicator */
.save-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.save-indicator.show {
    display: flex;
}

.save-indicator .save-icon {
    font-size: 1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Onboarding Overlay */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #1a1a1a;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease;
}

.onboarding-overlay.show {
    display: flex;
}

.onboarding-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
}

.onboarding-speech-bubble {
    position: absolute;
    top: 27%;
    left: 50%;
    transform: translateX(-50%);
    background: #2d2d2d;
    color: #ffffff;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.6s ease 0.3s both;
    white-space: nowrap;
    text-align: center;
}

.onboarding-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #2d2d2d;
}

.onboarding-character {
    position: absolute;
    top: 39%;
    left: 50%;
    transform: translateX(-50%);
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.onboarding-hero-img {
    width: 250px;
    height: auto;
    object-fit: contain;
}

.onboarding-continue-btn {
    position: absolute;
    bottom: 80px;
    background: #1CB0F6;
    color: white;
    border: none;
    padding: 16px 60px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(28, 176, 246, 0.3);
    animation: fadeIn 0.5s ease 1s both;
}

.onboarding-continue-btn:hover {
    background: #1899D6;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(28, 176, 246, 0.4);
}

.onboarding-continue-btn:active {
    transform: translateY(0);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.3) translateY(-20px);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1.05);
    }
    70% {
        transform: translateX(-50%) scale(0.9);
    }
    100% {
        transform: translateX(-50%) scale(1);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateX(-50%) translateY(0px);
    }
    50% {
        transform: translateX(-50%) translateY(-20px);
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .left-panel {
        width: 25%;
    }
    .center-panel {
        width: 45%;
    }
    .right-panel {
        width: 30%;
    }
}

@media (max-width: 768px) {
    .success-confirmation-bar {
        padding: 1rem;
    }
    
    .success-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .success-message {
        width: 100%;
        justify-content: center;
    }
    
    .success-actions {
        width: 100%;
        justify-content: center;
    }
    
    .success-text {
        font-size: 1.5rem;
    }
    
    .xp-reward {
        font-size: 1rem;
    }


    .app-container {
        flex-direction: column;
    }
    
    .resize-handle {
        display: none;
    }
    
    .panel {
        width: 100% !important;
        min-width: 100%;
    }
    
    .left-panel {
        height: auto;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .lesson-header {
        padding: 1rem;
    }
    
    .lesson-content {
        padding: 1rem;
    }
    
    .character-section {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .suggestion-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .suggestion-item {
        flex: 1;
        min-width: 120px;
    }
    
    .input-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .generate-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Lesson Error Popup Styles */
.lesson-error-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

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

.error-content {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: popIn 0.4s ease-out;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.error-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.5rem 0 1.5rem;
    position: relative;
}

.error-icon {
    font-size: 2rem;
    animation: wiggle 0.5s ease-in-out;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.error-header h3 {
    font-size: 1.3rem;
    color: #ff6b35;
    margin: 0;
    flex: 1;
}

.close-error {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-error:hover {
    background: #f0f0f0;
    color: #333;
}

.error-message {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
}

.error-message p {
    margin-bottom: 1rem;
    color: #333;
    line-height: 1.5;
}

.suggestion-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.suggestion-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-align: left;
}

.suggestion-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.error-note {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin-top: 1rem;
}