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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-image: url('images/bg-game.png');
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* LOADER STYLES */
.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('images/bg-game.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 1s ease-out, visibility 1s ease-out;
}

.loader-container.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-title {
    font-size: 3em;
    color: white;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 2px 2px 4px rgba(0,0,0,0.3); }
    to { text-shadow: 0 0 20px rgba(255,255,255,0.6), 2px 2px 4px rgba(0,0,0,0.3); }
}

.loader-subtitle {
    font-size: 1.2em;
    color: rgba(255,255,255,0.9);
    margin-bottom: 40px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.code-animation {
    background: rgba(0,0,0,0.8);
    border-radius: 15px;
    padding: 30px;
    font-family: 'Courier New', monospace;
    color: #4CAF50;
    margin-bottom: 30px;
    border: 2px solid #4CAF50;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    min-width: 400px;
}

.code-line {
    margin-bottom: 10px;
    opacity: 0;
    animation: typewriter 0.8s forwards;
    white-space: nowrap;
    overflow: hidden;
}

.code-line:nth-child(1) { animation-delay: 0.5s; }
.code-line:nth-child(2) { animation-delay: 1.2s; }
.code-line:nth-child(3) { animation-delay: 1.9s; }
.code-line:nth-child(4) { animation-delay: 2.6s; }

@keyframes typewriter {
    from {
        width: 0;
        opacity: 1;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

.loading-bar-container {
    width: 300px;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
    border-radius: 4px;
    width: 0%;
    animation: loadProgress 3.5s ease-out forwards;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

@keyframes loadProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

.loading-text {
    color: rgba(255,255,255,0.8);
    font-size: 0.9em;
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% { content: 'Carregando'; }
    40% { content: 'Carregando.'; }
    60% { content: 'Carregando..'; }
    80%, 100% { content: 'Carregando...'; }
}

.programming-icons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    animation: iconFloat 2s ease-in-out infinite;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.icon img{
    width: 30px;
    height: 30px;
}

.icon:nth-child(1) {
    background: linear-gradient(45deg, #f1c40f55, #ffcc0055);
    animation-delay: 0s;
}

.icon:nth-child(2) {
    background: linear-gradient(45deg, #e74d3c4a, #c03a2b4a);
    animation-delay: 0.3s;
}

.icon:nth-child(3) {
    background: linear-gradient(45deg, #61dafb4e, #21d4fd4e);
    animation-delay: 0.6s;
}

.icon:nth-child(4) {
    background: linear-gradient(45deg, #27ae604e, #2ecc714e);
    animation-delay: 0.9s;
}

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


/* GAME CONTAINER (hidden initially) */
.game-container {
    background: rgba(0, 0, 0, 0.407);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 1100px;
    width: 100%;
    border: 1px solid #6B00E4;
    overflow: hidden;
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: scale(0.9);
    transition: all 1s ease-out;
}

.game-container.show {
    opacity: 1;
    transform: scale(1);
}

.game-header {
    background: linear-gradient(45deg, #6B00E4, #1c013b);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.game-header h1 {
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.level-indicator {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9em;
}

/* TELA DE SELEÇÃO */
.selection-screen {
    padding: 40px;
    text-align: center;
}

.selection-title {
    font-size: 1.5em;
    color: #fff;
    margin-bottom: 15px;
    font-weight: bold;
}

.tracks-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.track-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 15px;
    padding: 10px 20px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.track-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1));
    opacity: 0;
    transition: opacity 0.3s;
}

.track-card:hover::before {
    opacity: 1;
}

.track-card.javascript {
    border-color: #f1c40f;
    background: transparent;
}

.track-card.javascript:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(241, 196, 15, 0.3);
}

.track-card.logic {
    border-color: #45bb00;
    background: transparent;
}

.track-card.logic:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(4, 132, 0, 0.3);
}

.track-card.css {
    border-color: #e74c3c;
    background: transparent;
}

.track-card.css:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(231, 76, 60, 0.3);
}

.track-icon {
    font-size: 4em;
    margin-bottom: 0px;
}
.track-icon img{
    width: 64px;
    height: 64px;
}

.track-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #fff;
}

.track-description {
    color: #f4f4f4;
    line-height: 1.5;
    margin-bottom: 15px;
}

.track-concepts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.concept-tag {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

/* TELA DE JOGO */
.game-content {
    padding: 30px;
    display: flex;
    gap: 30px;
    min-height: 500px;
}

.story-panel {
    flex: 1;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border-left: 5px solid #6B00E4;
}

.code-panel {
    flex: 1;
    background: #2d3748;
    border-radius: 15px;
    padding: 25px;
    color: white;
    position: relative;
}

.story-text {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #2c3e50;
}

.character {
    width: 60px;
    height: 60px;
    background: #FF6B6B;
    border-radius: 50%;
    margin: 15px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.character.moving {
    transform: translateX(20px) scale(1.1);
    background: #4ECDC4;
}

.code-editor {
    background: #1a202c;
    border-radius: 10px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    min-height: 200px;
    border: 2px solid #4CAF50;
    margin-bottom: 20px;
}

.code-line {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 5px;
    transition: background 0.2s;
    position: relative;
}

.code-line:hover {
    background: rgba(76, 175, 80, 0.1);
}

.code-line.user-line {
    background: rgba(255, 215, 0, 0.1);
    border-left: 3px solid #FFD700;
}

.code-line.user-line:hover {
    background: rgba(255, 215, 0, 0.2);
}

.line-number {
    color: #718096;
    margin-right: 15px;
    min-width: 20px;
}

.command-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    margin: 3px;
    font-size: 0.85em;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
    min-width: 80px;
    text-align: center;
}

.command-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.clear-btn, .undo-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    margin: 3px;
    font-size: 0.85em;
    transition: all 0.2s;
    font-weight: bold;
}

.clear-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.undo-btn {
    background: #f39c12;
}

.undo-btn:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.4);
}

.code-controls {
    margin-bottom: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.remove-line-btn {
    background: #e74c3c;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7em;
    margin-left: 10px;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.code-line.user-line:hover .remove-line-btn {
    opacity: 1;
}

.remove-line-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.available-commands h3 {
    color: #4CAF50;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.run-btn {
    background: linear-gradient(45deg, #6B00E4, #290058);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    width: 100%;
    margin-top: 15px;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.run-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.3);
}

.run-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.result-panel {
    background: #e8f5e8;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    border-left: 4px solid #4CAF50;
    display: none;
}

.result-panel.show {
    display: block;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.next-btn {
    background: #6c5ce7;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    margin-top: 15px;
    font-size: 1em;
    transition: all 0.2s;
}

.next-btn:hover {
    background: #5f3dc4;
    transform: scale(1.05);
}

.concept-explanation {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    color: #856404;
}

.concept-explanation h4 {
    color: #d63031;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.back-btn {
    background: #d63031;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 0.9em;
    transition: all 0.2s;
}

.back-btn:hover {
    background: #a10505;
    transform: scale(1.05);
}

.hidden {
    display: none !important;
}

.track-card.react {
    border-color: #9b59b6;
    background: transparent;
}

.track-card.react:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(155, 89, 182, 0.3);
}

footer{
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #cecece;
}

footer .developer-info{
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    font-size: 0.75rem;
    color: #cecece;
    letter-spacing: 1px;
}
.developer-info img {
    width: 150px;
    height: 30px;
}

/* Atualizar o grid para acomodar 5 trilhas */
.tracks-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* Animações especiais para React */
.character.react-animation {
    background: linear-gradient(45deg, #61dafb, #21d4fd);
    animation: reactSpin 1.5s ease-in-out;
}


@keyframes reactSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Animações especiais para Bootstrap */
.character.bootstrap-animation {
    background: linear-gradient(45deg, #7952b3, #563d7c);
    animation: bootstrapPulse 1.5s ease-in-out;
}

@keyframes bootstrapPulse {
    0% { transform: scale(1); box-shadow: 0 4px 15px rgba(121, 82, 179, 0.4); }
    50% { transform: scale(1.15); box-shadow: 0 8px 25px rgba(121, 82, 179, 0.6); }
    100% { transform: scale(1); box-shadow: 0 4px 15px rgba(121, 82, 179, 0.4); }
}

/* Responsividade melhorada para 5 trilhas */
@media (max-width: 1200px) {
    .tracks-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .tracks-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .track-card {
        padding: 25px 15px;
    }

    .game-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }

    .tracks-container {
        grid-template-columns: 1fr;
    }
}