/* Global styles and reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', 'Arial', sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Main container - adapts to iframe or standalone */
#mainContainer {
    width: 100%;
    height: 450px; /* Default for iframe */
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

/* Standalone mode detection */
@media (min-height: 500px) {
    body:not(.iframe-mode) #mainContainer {
        height: 90vh;
    }
}

/* Tooltip - centered, non-intrusive */
.tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 20px;
    border-radius: 15px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tooltip.show {
    opacity: 1;
}

/* Progress container - compact at top */
.progress-container {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.score-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    font-size: 18px;
    color: #FF6B6B;
}

.score-icon {
    font-size: 22px;
}

/* Game area - main content */
#gameArea {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow-y: auto;
    gap: 10px;
}

/* Story panel - cute character-based design */
.story-panel {
    background: white;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 15px;
    align-items: center;
    transition: transform 0.3s;
}

.story-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.character-container {
    flex-shrink: 0;
}

.character-image {
    font-size: 60px;
    animation: bounce 2s infinite;
}

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

.story-text {
    flex: 1;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
}

/* Sorting area */
.sorting-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sorting-area.hidden {
    display: none;
}

.categories-container {
    display: flex;
    gap: 10px;
    justify-content: space-around;
}

.category-box {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: all 0.3s;
    min-height: 100px;
}

.category-box:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.empathy-box {
    border: 3px dashed #4CAF50;
}

.not-empathy-box {
    border: 3px dashed #FF6B6B;
}

.category-box.drag-over {
    background: #f0f0f0;
    transform: scale(1.05);
}

.category-icon {
    font-size: 30px;
    margin-bottom: 5px;
}

.category-label {
    font-weight: bold;
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
}

.drop-zone {
    min-height: 40px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Response cards - draggable items */
.response-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
}

.response-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 12px;
    cursor: grab;
    font-size: 13px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    user-select: none;
    text-align: center;
    min-width: 120px;
    max-width: 200px;
}

.response-card:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.response-card:active {
    cursor: grabbing;
}

.response-card.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
    animation: correctPulse 0.5s;
}

.response-card.incorrect {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    animation: shake 0.5s;
}

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

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

/* Choice area - buttons */
.choice-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
}

.choice-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    width: 100%;
    text-align: center;
    white-space: normal;
    line-height: 1.3;
    min-height: 44px; /* Touch-friendly size */
}

.choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.choice-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.start-btn {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    font-size: 18px;
    padding: 15px 25px;
}

.choice-btn.selected {
    background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
}

.hidden {
    display: none !important;
}

/* Audio controls - bottom right corner */
.audio-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
}

.audio-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.audio-btn.muted {
    opacity: 0.5;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .story-text {
        font-size: 14px;
    }
    
    .character-image {
        font-size: 50px;
    }
    
    .response-card {
        font-size: 12px;
        min-width: 100px;
    }
    
    .choice-btn {
        font-size: 14px;
    }
}