/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'SimHei', sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #333;
    overflow-x: hidden;
}

/* Responsive container - adapts to iframe vs full screen */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    position: relative;
}

/* Full screen mode detection */
@media (min-height: 500px) {
    .container {
        height: 90vh;
        gap: 12px;
        padding: 12px;
    }
}

/* Story section with visual scenes */
.story-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 12px;
    flex: 0 0 auto;
    height: 120px;
}

.scene-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    position: relative;
}

.scene {
    display: none;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
}

.scene.active {
    display: block;
}

.scene-image {
    font-size: 2.5rem;
    margin-bottom: 8px;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
}

.scene-text {
    font-size: 14px;
    font-weight: 500;
    color: #1976d2;
}

.scene-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 8px;
}

.nav-btn {
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(33,150,243,0.3);
}

.nav-btn:hover {
    background: #1976d2;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(33,150,243,0.4);
}

.nav-btn:active {
    transform: scale(0.95);
}

.scene-indicator {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    min-width: 30px;
    text-align: center;
}

/* Discussion panel */
.discussion-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

/* Prompt cards with expandable content */
.prompt-cards {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.prompt-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.prompt-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-color: #e3f2fd;
}

.prompt-card.expanded {
    border-color: #2196f3;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1976d2;
}

.expand-icon {
    font-size: 16px;
    font-weight: bold;
    color: #666;
    transition: transform 0.3s ease;
}

.prompt-card.expanded .expand-icon {
    transform: rotate(45deg);
}

.card-content {
    display: none;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
}

.prompt-card.expanded .card-content {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.discussion-question {
    font-size: 12px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.sentence-frames {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.frame-item {
    background: #f0f7ff;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    border-left: 3px solid #2196f3;
}

.fill-blank {
    background: #fff3e0;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px dashed #ff9800;
    min-width: 60px;
    display: inline-block;
    text-align: center;
    cursor: text;
    transition: all 0.3s ease;
}

.fill-blank:focus {
    outline: none;
    background: #fff;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33,150,243,0.2);
}

/* Activity controls */
.activity-controls {
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.timer-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-display {
    font-size: 14px;
    font-weight: 600;
    color: #1976d2;
    min-width: 70px;
}

.timer-controls {
    display: flex;
    gap: 4px;
}

.control-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 28px;
}

.control-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
}

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

.group-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.group-selector label {
    color: #666;
    font-weight: 500;
}

.group-selector select {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 11px;
    background: white;
    cursor: pointer;
}

/* Summary section */
.summary-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.summary-header {
    padding: 10px 12px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: #1976d2;
    transition: background-color 0.3s ease;
}

.summary-header:hover {
    background: #e3f2fd;
}

.summary-content {
    display: none;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
}

.summary-content.expanded {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.summary-content textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.summary-content textarea:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33,150,243,0.2);
}

.summary-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    justify-content: flex-end;
}

.action-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
    min-height: 28px;
}

.action-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.action-btn.primary {
    background: #2196f3;
    color: white;
    border-color: #2196f3;
}

.action-btn.primary:hover {
    background: #1976d2;
    border-color: #1976d2;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 12px;
    max-width: 280px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.tooltip.show {
    opacity: 1;
}

.tooltip-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: #64b5f6;
}

.tooltip-text {
    line-height: 1.4;
}

/* Help button */
.help-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: #2196f3;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(33,150,243,0.3);
}

.help-btn:hover {
    background: #1976d2;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(33,150,243,0.4);
}

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

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 200px; }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 6px;
        gap: 6px;
    }
    
    .story-section {
        height: 100px;
        padding: 8px;
    }
    
    .scene-image {
        font-size: 2rem;
    }
    
    .scene-text {
        font-size: 12px;
    }
    
    .nav-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .activity-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    
    .timer-section {
        justify-content: center;
    }
    
    .group-selector {
        justify-content: center;
    }
    
    /* Increase touch targets for mobile */
    .control-btn, .action-btn {
        min-height: 36px;
        padding: 8px 12px;
    }
    
    .fill-blank {
        min-height: 32px;
        padding: 6px 8px;
    }
}