/* Buchstabenraupe - Lernspiel Styles */
/* Verwendet nur Web-Safe Fonts für Joomla 4 Integration */

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

#game-container {
    width: 100%;
    max-width: 800px;
    height: 600px;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header */
#game-header {
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
}

#score-display {
    display: flex;
    gap: 30px;
    font-size: 16px;
    font-weight: bold;
}

#game-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #3498db;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#help-btn {
    width: 50px;
    height: 50px;
    background: #e74c3c;
    font-size: 24px;
    font-weight: bold;
    border: 3px solid #fff;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
    animation: pulse-help 2s infinite;
}

@keyframes pulse-help {
    0% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 25px rgba(231, 76, 60, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
    }
}

.control-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

#help-btn:hover {
    background: #c0392b;
    transform: scale(1.2);
    animation: none;
}

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

/* Game Area */
#game-area {
    flex: 1;
    position: relative;
    background: #f5f5f5;
    overflow: hidden;
}

#caterpillar-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.caterpillar-segment {
    width: 50px;
    height: 50px;
    border: 3px solid #2c3e50;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    min-width: 50px;
    min-height: 50px;
}

.caterpillar-segment.correct {
    background: #2ecc71;
    color: white;
}

.caterpillar-segment.incorrect {
    background: #e74c3c;
    color: white;
}

.caterpillar-segment.neutral {
    background: #3498db;
    color: white;
}

.caterpillar-segment.incorrect:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.caterpillar-segment.neutral:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.caterpillar-head {
    width: 50px;
    height: 50px;
    border: 3px solid #2c3e50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: #f39c12;
    color: white;
    user-select: none;
    min-width: 50px;
    min-height: 50px;
    margin-bottom: 5px;
}

.caterpillar-segment.removing {
    animation: pop-out 0.3s ease-out forwards;
}

@keyframes pop-out {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Footer */
#game-footer {
    background: #ecf0f1;
    padding: 15px 20px;
    min-height: 80px;
}

#progress-bar {
    width: 100%;
    height: 10px;
    background: #bdc3c7;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f39c12, #e67e22);
    width: 0%;
    transition: width 0.3s ease;
}

#level-info {
    text-align: center;
    font-size: 16px;
    color: #2c3e50;
    font-weight: bold;
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 15px;
}

.overlay-header h3 {
    color: #2c3e50;
    font-size: 24px;
}

.close-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: #c0392b;
}

.action-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    min-width: 120px;
    min-height: 44px;
}

.action-btn:hover {
    background: #229954;
    transform: translateY(-2px);
}

#help-text {
    font-size: 16px;
    line-height: 1.6;
    color: #2c3e50;
}

/* Bonus Collection Styles */
.bonus-terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.bonus-term-btn {
    padding: 10px 15px;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.bonus-term-btn:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
}

.bonus-term-btn.collected {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
    cursor: default;
    transform: none;
}

.bonus-term-btn.collected:hover {
    background: #27ae60;
    color: white;
    transform: none;
}

.bonus-term-btn.clicked {
    cursor: default;
    transform: none;
}

.bonus-term-btn.correct {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

.bonus-term-btn.incorrect {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.bonus-term-btn.disabled {
    background: #bdc3c7;
    color: #7f8c8d;
    border-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 768px) {
    #game-container {
        height: 100vh;
        border-radius: 0;
        max-width: none;
    }
    
    #score-display {
        gap: 15px;
        font-size: 14px;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .caterpillar-segment {
        width: 45px;
        height: 45px;
        font-size: 18px;
        min-width: 45px;
        min-height: 45px;
    }
    
    .overlay-content {
        padding: 20px;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    #game-header {
        padding: 10px 15px;
        min-height: 50px;
    }
    
    #score-display {
        gap: 10px;
        font-size: 12px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .caterpillar-segment {
        width: 40px;
        height: 40px;
        font-size: 16px;
        min-width: 40px;
        min-height: 40px;
    }
    
    #game-footer {
        padding: 10px 15px;
        min-height: 60px;
    }
    
    #level-info {
        font-size: 14px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Feedback animation */
@keyframes feedback-float {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-30px);
        opacity: 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .caterpillar-segment.correct {
        background: #000;
        color: #fff;
        border-color: #fff;
    }
    
    .caterpillar-segment.incorrect {
        background: #fff;
        color: #000;
        border-color: #000;
    }
}
