* {
    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: 20px;
    color: #333;
    position: relative;
}

.app-container {
    display: grid;
    grid-template-columns: 300px 1fr 350px;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 40px);
}

/* Block Palette */
.block-palette {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.palette-header h2 {
    font-size: 24px;
    color: #4a5568;
    margin: 0;
}

.assignment-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.assignment-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
}

.block-category {
    margin-bottom: 30px;
}

.block-category h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #2d3748;
    padding: 10px;
    background: #f7fafc;
    border-radius: 10px;
    text-align: center;
}

.block {
    display: flex;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    border-radius: 15px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: bold;
    font-size: 16px;
}

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

.block:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.block-icon {
    font-size: 24px;
    margin-right: 10px;
}

.block-text {
    flex: 1;
}

.action-block {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border: 3px solid #ff6b9d;
}

.control-block {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border: 3px solid #4ecdc4;
}

/* Coding Area */
.coding-area {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.coding-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.coding-header h2 {
    font-size: 24px;
    color: #4a5568;
}

.run-button, .clear-button, .check-button {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.run-button {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.4);
}

.run-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.6);
}

.clear-button {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(250, 112, 154, 0.4);
}

.clear-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(250, 112, 154, 0.6);
}

.check-button {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(132, 250, 176, 0.4);
}

.check-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(132, 250, 176, 0.6);
}

.button-icon {
    font-size: 18px;
    margin-right: 8px;
}

.drop-zone {
    flex: 1;
    border: 3px dashed #cbd5e0;
    border-radius: 15px;
    padding: 20px;
    min-height: 400px;
    background: #f8fafc;
    position: relative;
}

.drop-zone.drag-over {
    border-color: #4facfe;
    background: #e6f7ff;
}

.drop-hint {
    text-align: center;
    color: #a0aec0;
    margin-top: 50px;
}

.drop-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
}

.drop-hint p {
    font-size: 18px;
    font-weight: bold;
}

.code-block {
    margin: 10px 0;
    position: relative;
}

.delete-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.code-block:hover .delete-btn {
    opacity: 1;
}

/* Character Stage */
.character-stage {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.character-stage h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #4a5568;
    text-align: center;
}

.stage-area {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    height: 400px;
    position: relative;
    overflow: hidden;
    border: 3px solid #4c51bf;
}

.character {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    transition: all 0.5s ease;
}

.character-body {
    font-size: 80px;
    margin-bottom: 10px;
    filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.3));
}

.character-name {
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    color: #4a5568;
    font-size: 14px;
}

/* Animations */
@keyframes dance {
    0%, 100% { transform: translateX(-50%) rotate(0deg) scale(1); }
    25% { transform: translateX(-50%) rotate(-10deg) scale(1.1); }
    50% { transform: translateX(-50%) rotate(10deg) scale(1.2); }
    75% { transform: translateX(-50%) rotate(-5deg) scale(1.1); }
}

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

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

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.2); }
}

@keyframes spin {
    0% { transform: translateX(-50%) rotate(0deg); }
    100% { transform: translateX(-50%) rotate(360deg); }
}

@keyframes sleep {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
    50% { transform: translateX(-50%) scale(0.8); opacity: 0.6; }
}

@keyframes grow {
    0% { transform: translateX(-50%) scale(1); }
    100% { transform: translateX(-50%) scale(1.5); }
}

@keyframes shrink {
    0% { transform: translateX(-50%) scale(1); }
    100% { transform: translateX(-50%) scale(0.5); }
}

.character.dancing {
    animation: dance 1s ease-in-out;
}

.character.jumping {
    animation: jump 0.6s ease-in-out;
}

.character.waving {
    animation: wave 1s ease-in-out;
}

.character.bouncing {
    animation: bounce 0.5s ease-in-out;
}

.character.spinning {
    animation: spin 0.8s ease-in-out;
}

.character.sleeping {
    animation: sleep 1.2s ease-in-out;
}

.character.growing {
    animation: grow 0.6s ease-in-out;
}

.character.shrinking {
    animation: shrink 0.6s ease-in-out;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 250px 1fr 300px;
    }
}

/* Assignment Panel */
.assignment-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    width: 90%;
    max-width: 500px;
    display: none;
}

.assignment-header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.assignment-header h2 {
    margin: 0;
    font-size: 24px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.assignment-content {
    padding: 30px;
    text-align: center;
}

.assignment-title {
    font-size: 28px;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 15px;
}

.assignment-description {
    font-size: 20px;
    color: #4a5568;
    margin-bottom: 20px;
    line-height: 1.4;
}

.assignment-goal {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.assignment-footer {
    background: #f7fafc;
    padding: 20px;
    border-radius: 0 0 20px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.assignment-counter {
    font-weight: bold;
    color: #4a5568;
    font-size: 16px;
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        gap: 15px;
    }
    
    .block-palette {
        max-height: 200px;
    }
    
    .character-stage {
        order: -1;
    }
    
    .assignment-panel {
        width: 95%;
        max-width: none;
    }
    
    .assignment-content {
        padding: 20px;
    }
    
    .assignment-title {
        font-size: 24px;
    }
    
    .assignment-description {
        font-size: 18px;
    }
    
    .nav-btn {
        padding: 8px 15px;
        font-size: 12px;
    }
}