* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    animation: float-bg 20s ease-in-out infinite;
}

@keyframes float-bg {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #667eea;
}

h1 {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 20px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.1em;
    font-weight: bold;
    color: #764ba2;
}

.level-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.level-category {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #667eea;
    transition: all 0.3s ease;
}

.level-category:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.level-category h4 {
    margin: 0 0 10px 0;
    text-align: center;
    color: #667eea;
}

.category-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    border-radius: 8px;
    transition: background 0.3s;
}

.category-header:hover {
    background: rgba(102, 126, 234, 0.1);
}

.toggle-icon {
    font-size: 0.8em;
    transition: transform 0.3s;
}

.category-content {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-content.collapsed {
    max-height: 0;
}

.challenge-description {
    transition: none;
    max-height: none;
    overflow: visible;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    white-space: pre-wrap;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.challenge-description-wrapper {
    margin: 15px 0;
}

.desc-header, .hint-header {
    cursor: pointer;
    user-select: none;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-weight: bold;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.desc-header:hover, .hint-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.progress-dots {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 10px;
}

.desc-toggle-icon {
    font-size: 0.8em;
    transition: transform 0.3s;
    display: inline-block;
}

.progress-info {
    cursor: pointer;
    user-select: none;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-weight: bold;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.collapsible-content {
    max-height: 3000px;
    overflow: auto;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 !important;
}

.section-toggle {
    font-size: 0.8em;
    transition: transform 0.3s;
    display: inline-block;
    margin-left: 5px;
}

.editor-header, .output-header {
    cursor: pointer;
    user-select: none;
}

.achievements h3, .shop h3 {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    padding: 10px;
    border-radius: 8px;
}

.achievements h3:hover, .shop h3:hover {
    background: rgba(255, 255, 255, 0.1);
}
    font-size: 1.2em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.level-category .level-btn {
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

.level-category .level-btn:last-child {
    margin-bottom: 0;
}

.level-btn {
    padding: 12px 24px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.level-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.level-btn:hover::before {
    width: 300px;
    height: 300px;
}

.level-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.level-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.level-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.challenge-section {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 15px;
    border-left: 5px solid #667eea;
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.challenge-header h2 {
    color: #333;
    font-size: 1.5em;
}

.difficulty {
    font-size: 1.5em;
}

.challenge-description {
    color: #555;
    line-height: 1.8;
    font-size: 1.1em;
    white-space: pre-line;
}

.progress-tracker {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid rgba(102, 126, 234, 0.3);
}

.progress-info {
    text-align: center;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 10px;
}

.challenge-navigation {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.nav-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.nav-btn:active {
    transform: translateY(0);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #333 !important;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid #666;
}

.progress-dot.completed {
    background: #4caf50 !important;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
    border-color: #4caf50;
}

.progress-dot.skipped {
    background: #667eea !important;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    border-color: #667eea;
}

.progress-dot.current {
    background: #ffffff !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    transform: scale(1.3);
    border-color: #ffffff;
}

.progress-dot:hover {
    transform: scale(1.2);
    border-color: #667eea;
}

.hint-section {
    margin-top: 15px;
}

.hint-btn {
    padding: 8px 16px;
    background: #ffa726;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.hint-btn:hover {
    background: #fb8c00;
    transform: scale(1.05);
}

.hint {
    margin-top: 10px;
    padding: 15px;
    background: #fff3e0;
    border-left: 4px solid #ffa726;
    border-radius: 8px;
    color: #333;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
}

.code-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-header, .output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #37474f;
    color: white;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
}

.clear-btn, .clear-output-btn {
    padding: 5px 12px;
    background: #ff5252;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.clear-btn:hover, .clear-output-btn:hover {
    background: #ff1744;
}

#code-editor {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 0 0 8px 8px;
    resize: vertical;
    background: #1e1e1e;
    color: #d4d4d4;
    line-height: 1.6;
    tab-size: 4;
}

#code-editor:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.run-btn {
    padding: 15px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.run-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.run-btn:hover::before {
    left: 100%;
}

.run-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.run-btn:active {
    transform: translateY(0);
}

.output-section {
    display: flex;
    flex-direction: column;
}

.output-console {
    min-height: 300px;
    padding: 15px;
    background: #1e1e1e;
    color: #4caf50;
    font-family: 'Consolas', 'Monaco', monospace;
    border: 2px solid #ddd;
    border-radius: 0 0 8px 8px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-section {
    grid-column: 1 / -1;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section.success {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

.result-section.error {
    background: linear-gradient(135deg, #ff5252 0%, #ff1744 100%);
    color: white;
}

.result-message {
    font-size: 1.3em;
    margin-bottom: 15px;
    font-weight: bold;
}

.next-btn {
    padding: 12px 30px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.next-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.achievements {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.achievements h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.5em;
}

.shop {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 20px;
    border-radius: 15px;
}

.shop h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.5em;
}

.shop-controls {
    margin-bottom: 15px;
    text-align: center;
}

.reset-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff5252 0%, #ff1744 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.reset-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 82, 82, 0.4);
}

.cheat-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ffa726 0%, #fb8c00 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.cheat-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 167, 38, 0.4);
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.shop-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.shop-item:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
}

.shop-icon {
    font-size: 3em;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.shop-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.shop-price {
    color: #ffa726;
    font-weight: bold;
    font-size: 1.2em;
}

#achievements-list {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.achievement {
    padding: 12px 20px;
    background: white;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.achievement:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.achievement.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

.achievement.unlocked {
    animation: unlock 0.5s ease;
    transform: scale(1.1);
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.achievement.unlocked::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #4caf50;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

@keyframes unlock {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
}

/* Zurück zum Menu Button */
.back-to-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 10000;
    cursor: pointer;
}

.back-to-menu:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.back-icon {
    color: white;
    font-size: 24px;
    font-weight: bold;
}