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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    touch-action: manipulation;
}

/* Container styles - responsive height */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Adjust height when not in iframe */
@media (min-height: 500px) {
    body:not(.iframe-mode) .container {
        height: 90vh;
    }
}

/* Activity cards section */
.activity-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    min-height: 80px;
    justify-content: center;
    align-items: flex-start;
}

/* Individual activity card */
.card {
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    user-select: none;
    touch-action: none;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border-color: #007bff;
}

.card:active,
.card.dragging {
    cursor: grabbing;
    transform: rotate(5deg) scale(1.05);
    z-index: 1000;
    opacity: 0.8;
}

.card img {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    margin-bottom: 2px;
}

.card span {
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    color: #333;
    line-height: 1.1;
}

/* Timeline section */
.timeline {
    display: flex;
    gap: 10px;
    flex: 1;
    min-height: 200px;
}

.time-section {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

/* Time section colors */
.time-section.morning {
    background: linear-gradient(135deg, #FFE5B4 0%, #FFEAA7 100%);
}

.time-section.afternoon {
    background: linear-gradient(135deg, #E6F3FF 0%, #A8E6CF 100%);
}

.time-section.evening {
    background: linear-gradient(135deg, #F0E6FF 0%, #DDA0DD 100%);
}

/* Time section header */
.time-header {
    padding: 8px;
    text-align: center;
    background: rgba(255,255,255,0.3);
    backdrop-filter: blur(10px);
}

.time-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.time-header h3 {
    font-size: 14px;
    margin: 2px 0;
    color: #333;
    font-weight: bold;
}

.time-range {
    font-size: 10px;
    color: #666;
    font-weight: normal;
}

/* Drop zone */
.drop-zone {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    position: relative;
}

.drop-hint {
    color: #666;
    font-size: 11px;
    text-align: center;
    font-style: italic;
    margin-top: 20px;
}

/* Drop zone states */
.drop-zone.drag-over {
    background: rgba(0,123,255,0.1);
    border: 2px dashed #007bff;
    border-radius: 8px;
}

.drop-zone.correct {
    background: rgba(40,167,69,0.1);
    border: 2px solid #28a745;
}

.drop-zone.incorrect {
    background: rgba(220,53,69,0.1);
    border: 2px solid #dc3545;
}

/* Cards in drop zones */
.drop-zone .card {
    width: 60px;
    height: 60px;
    margin: 2px auto;
}

.drop-zone .card img {
    width: 35px;
    height: 35px;
}

.drop-zone .card span {
    font-size: 8px;
}

/* Controls section */
.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
    flex-shrink: 0;
}

.check-btn, .reset-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 36px;
    white-space: nowrap;
}

.check-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40,167,69,0.3);
}

.reset-btn {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108,117,125,0.3);
}

/* Feedback section */
.feedback {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.feedback.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.feedback.hidden {
    display: none;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .activity-cards {
        gap: 6px;
        padding: 8px;
    }
    
    .card {
        width: 65px;
        height: 65px;
    }
    
    .card img {
        width: 35px;
        height: 35px;
    }
    
    .card span {
        font-size: 8px;
    }
    
    .timeline {
        gap: 8px;
    }
    
    .time-header h3 {
        font-size: 13px;
    }
    
    .time-range {
        font-size: 9px;
    }
    
    .drop-hint {
        font-size: 10px;
    }
    
    .check-btn, .reset-btn {
        padding: 6px 12px;
        font-size: 11px;
        min-height: 32px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .card {
        width: 75px;
        height: 75px;
    }
    
    .card img {
        width: 45px;
        height: 45px;
    }
    
    .check-btn, .reset-btn {
        min-height: 44px;
        padding: 10px 20px;
    }
}

/* Animation for correct/incorrect feedback */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.drop-zone.correct,
.drop-zone.incorrect {
    animation: pulse 0.6s ease-in-out;
}