/* =============================
   ESTILOS GLOBALES Y VARIABLES
   ============================= */

:root {
    /* Colores principales - Paleta futurista */
    --primary-color: #00d9ff;
    --secondary-color: #ff00ff;
    --accent-color: #00ff88;
    --dark-bg: #0a0a0a;
    --darker-bg: #050505;
    --light-text: #ffffff;
    --mid-text: #b0b0b0;
    --success-color: #00ff00;
    --error-color: #ff3366;
    --warning-color: #ffaa00;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #00d9ff 0%, #0099ff 100%);
    --gradient-secondary: linear-gradient(135deg, #ff00ff 0%, #aa00ff 100%);
    --gradient-dark: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
    --gradient-neon: linear-gradient(45deg, #00d9ff, #ff00ff, #00ff88);
    
    /* Sombras */
    --neon-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
    --box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    --inner-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    
    /* Tamaños */
    --header-height: 70px;
    --panel-width: 50%;
}

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

body {
    font-family: 'Space Mono', monospace;
    background-color: var(--dark-bg);
    color: var(--light-text);
    overflow: hidden;
    position: relative;
}

/* Background animado con estrellas - Capa 1 (Más pequeñas, rápidas) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(1px 1px at 15px 25px, #fff, transparent),
        radial-gradient(1px 1px at 45px 75px, #aaccff, transparent),
        radial-gradient(1px 1px at 85px 15px, #ffccaa, transparent),
        radial-gradient(1px 1px at 25px 65px, #ccffaa, transparent),
        radial-gradient(1px 1px at 65px 35px, #ffaacc, transparent),
        radial-gradient(1px 1px at 120px 80px, #fff, transparent),
        radial-gradient(1px 1px at 160px 20px, #aaccff, transparent),
        radial-gradient(1px 1px at 180px 60px, #ffccaa, transparent);
    background-size: 180px 180px;
    animation: starsMove1 60s linear infinite;
    opacity: 0.15;
    z-index: -1;
}

/* Background animado con estrellas - Capa 2 (Medianas, velocidad media) */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(2px 2px at 30px 40px, #fff, transparent),
        radial-gradient(2px 2px at 70px 90px, #ccddff, transparent),
        radial-gradient(1.5px 1.5px at 110px 30px, #ffddcc, transparent),
        radial-gradient(1.5px 1.5px at 150px 80px, #ddffcc, transparent),
        radial-gradient(2px 2px at 20px 120px, #ffccdd, transparent),
        radial-gradient(1.5px 1.5px at 190px 50px, #ccffdd, transparent);
    background-size: 220px 220px;
    animation: starsMove2 90s linear infinite;
    opacity: 0.12;
    z-index: -2;
}

@keyframes starsMove1 {
    from { transform: translateY(0) translateX(0); }
    to { transform: translateY(180px) translateX(30px); }
}

@keyframes starsMove2 {
    from { transform: translateY(0) translateX(0); }
    to { transform: translateY(220px) translateX(-20px); }
}

/* Estrellas adicionales que se mueven horizontalmente */
.game-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(1px 1px at 50px 100px, #aaffaa, transparent),
        radial-gradient(1px 1px at 150px 200px, #ffaaff, transparent),
        radial-gradient(1px 1px at 250px 50px, #aaffff, transparent),
        radial-gradient(1px 1px at 350px 150px, #ffffaa, transparent);
    background-size: 400px 250px;
    animation: starsHorizontal 120s linear infinite;
    opacity: 0.1;
    z-index: -3;
    pointer-events: none;
}

@keyframes starsHorizontal {
    from { transform: translateX(-400px); }
    to { transform: translateX(400px); }
}

/* =============================
   LOADER / PANTALLA DE CARGA
   ============================= */

.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--darker-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

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

.loader-content {
    text-align: center;
}

.robot-loader {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    margin: 0 auto 30px;
    position: relative;
    animation: robotPulse 1.5s ease-in-out infinite, robotRotate 4s linear infinite;
    text-shadow: 0 0 20px rgba(0, 217, 255, 0.8), 0 0 40px rgba(0, 217, 255, 0.4);
}

.robot-loader::before {
    content: '🤖';
    animation: robotBounce 2s ease-in-out infinite;
}

.robot-eye {
    display: none;
}

.robot-eye.left {
    display: none;
}

.robot-eye.right {
    display: none;
}

@keyframes robotPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes robotBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    40% {
        transform: translateY(-10px) rotate(5deg);
    }
    60% {
        transform: translateY(-5px) rotate(-5deg);
    }
}

.loader-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-shadow: 0 0 10px currentColor;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: var(--gradient-neon);
    background-size: 200% 100%;
    animation: loadingProgress 2s ease-in-out infinite;
}

@keyframes loadingProgress {
    0% { 
        width: 0%;
        background-position: 0% 50%;
    }
    50% {
        width: 100%;
        background-position: 100% 50%;
    }
    100% {
        width: 0%;
        background-position: 0% 50%;
    }
}

/* =============================
   CONTENEDOR PRINCIPAL
   ============================= */

.game-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.game-container.active {
    opacity: 1;
}

/* =============================
   HEADER DEL JUEGO
   ============================= */

.game-header {
    height: var(--header-height);
    background: var(--gradient-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    position: relative;
    overflow: hidden;
}

.game-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--primary-color) 50%, transparent 100%);
    animation: headerGlow 3s ease-in-out infinite;
}

@keyframes headerGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-section .robot-emoji {
    font-size: 2rem;
    display: inline-block;
    animation: robotRotate 4s linear infinite;
    text-shadow: 0 0 10px rgba(0, 217, 255, 0.6);
}

@keyframes robotRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-section h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    font-weight: 900;
    background: var(--gradient-neon);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.codeponce-logo {
    height: 40px;
    width: auto;
    opacity: 0.8;
    transition: all 0.3s ease;
    filter: brightness(1.1);
}

.codeponce-logo:hover {
    opacity: 1;
    transform: scale(1.05);
    filter: brightness(1.3) drop-shadow(0 0 10px rgba(0, 217, 255, 0.3));
}

/* Sección central del header */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 20px;
}

.game-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px;
    background: rgba(0, 217, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 90px;
    min-height: 40px;
    box-sizing: border-box;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.stat-item:hover::before {
    left: 100%;
}

.stat-item:hover {
    background: rgba(0, 217, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 217, 255, 0.3);
    border-color: rgba(0, 217, 255, 0.5);
}

.stat-item i {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--mid-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--light-text);
}

/* Estilos específicos por tipo de stat */
.energy-stat i {
    color: var(--success-color);
}

.gems-stat i {
    color: var(--accent-color);
}

.level-stat i {
    color: var(--primary-color);
}

/* =============================
   PERFIL DEL JUGADOR
   ============================= */

.player-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 4px 16px;
    background: rgba(0, 217, 255, 0.08);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 217, 255, 0.1);
}

.player-profile::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.player-profile:hover::before {
    left: 100%;
}

.player-profile:hover {
    background: rgba(0, 217, 255, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 217, 255, 0.2);
    border-color: rgba(0, 217, 255, 0.4);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--dark-bg);
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.player-avatar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: avatarShimmer 2s ease-in-out infinite;
}

@keyframes avatarShimmer {
    0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--light-text);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.player-experience {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--accent-color);
    font-weight: 500;
}

.player-experience i {
    font-size: 0.85rem;
    color: var(--warning-color);
}

.player-actions {
    position: relative;
    z-index: 1;
}

.logout-btn {
    background: rgba(255, 51, 102, 0.1) !important;
    border: 1px solid rgba(255, 51, 102, 0.3) !important;
    color: var(--error-color) !important;
    padding: 8px !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    min-width: auto !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.logout-btn:hover {
    background: rgba(255, 51, 102, 0.2) !important;
    border-color: rgba(255, 51, 102, 0.5) !important;
    transform: scale(1.05) !important;
    box-shadow: 0 2px 10px rgba(255, 51, 102, 0.3) !important;
}

.logout-btn i {
    font-size: 1rem !important;
}

/* Controles del header */
.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.control-group {
    display: flex;
    gap: 8px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* =============================
   ÁREA PRINCIPAL DEL JUEGO
   ============================= */

.game-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* =============================
   PANEL DE COMANDOS
   ============================= */

.command-panel {
    width: var(--panel-width);
    display: flex;
    flex-direction: column;
}

.command-panel-content {
    flex: 1;
    padding: 10px 10px 0 10px; 
    display: flex;
    flex-direction: row;
    gap: 15px;
    overflow-y: hidden;
}

.commands-column {
    flex: 0 0 15%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 3px 3px 0 0;
}

.programming-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.panel-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.commands-section h3 {
    color: var(--accent-color);
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.commands-help {
    font-size: 0.7rem;
    color: var(--mid-text);
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(0, 217, 255, 0.05);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 6px;
    line-height: 1.3;
    font-style: italic;
}

.command-blocks {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.command-block {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.command-block::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, var(--primary-color), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.command-block:hover::before {
    animation: shimmer 0.5s ease;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
        opacity: 0;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
        opacity: 0;
    }
}

.command-block:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 217, 255, 0.4);
    background: rgba(0, 217, 255, 0.1);
}

.command-block:active {
    cursor: pointer;
    transform: scale(0.95);
}

/* Estilo para efecto de click/agregado automático */
.command-block.clicked {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--accent-color);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.6);
    animation: clickPulse 0.3s ease;
}

@keyframes clickPulse {
    0% {
        transform: scale(1);
        background: rgba(0, 255, 136, 0.1);
    }
    50% {
        transform: scale(1.05);
        background: rgba(0, 255, 136, 0.3);
    }
    100% {
        transform: scale(1);
        background: rgba(0, 255, 136, 0.2);
    }
}



.command-block i {
    font-size: 1.2rem;
    color: var(--primary-color);
    display: block;
    margin-bottom: 3px;
}

.command-block span {
    font-size: 0.7rem;
    font-weight: 600;
}

/* Colores específicos por tipo de comando */
.command-block[data-command="collect"] {
    border-color: var(--accent-color);
}

.command-block[data-command="collect"] i {
    color: var(--accent-color);
}

/* =============================
   ÁREA DE PROGRAMACIÓN
   ============================= */

.code-sequence {
    background: rgba(0, 0, 0, 0.5);
    border: 2px dashed rgba(0, 217, 255, 0.3);
    border-radius: 8px;
    padding: 10px;
    min-height: 150px;
    flex: 1;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.code-sequence.drag-over {
    border-color: var(--accent-color);
    border-width: 1px;
    background: rgba(0, 255, 136, 0.05);
    box-shadow: inset 0 0 20px rgba(0, 255, 136, 0.2);
}

.drop-zone {
    text-align: center;
    color: var(--mid-text);
    padding: 20px;
    font-style: italic;
    font-size: 0.8rem;
}

.code-sequence .command-block {
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

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

.command-block.executing {
    animation: executeCommand 0.5s ease;
    box-shadow: 0 0 30px var(--accent-color);
    border-color: var(--accent-color);
}

@keyframes executeCommand {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* =============================
   CONTROLES DE EJECUCIÓN
   ============================= */

.execution-controls-footer {
    padding: 15px 15px 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}



/* Estilos de botones de control mejorados */
.control-btn {
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
    width: auto;
    flex-shrink: 0;
}

/* Botón primario */
.primary-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0099ff 100%);
    box-shadow: 0 2px 10px rgba(0, 217, 255, 0.3);
    min-height: 44px !important;
    padding: 12px 20px !important;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #00f0ff 0%, #00aaff 100%);
    box-shadow: 0 4px 15px rgba(0, 217, 255, 0.5);
    transform: translateY(-1px);
}

/* Botón secundario */
.secondary-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #aa00ff 100%);
    box-shadow: 0 2px 10px rgba(255, 0, 255, 0.3);
    min-height: 44px !important;
    padding: 12px 20px !important;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #ff33ff 0%, #cc00ff 100%);
    box-shadow: 0 4px 15px rgba(255, 0, 255, 0.5);
    transform: translateY(-1px);
}

/* Botones de navegación */
.nav-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    color: var(--light-text);
    border: 1px solid rgba(0, 217, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-height: 44px !important;
    padding: 12px 20px !important;
}

.nav-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.2) 0%, rgba(0, 217, 255, 0.1) 100%);
    border-color: rgba(0, 217, 255, 0.6);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(135deg, rgba(128, 128, 128, 0.1) 0%, rgba(128, 128, 128, 0.05) 100%);
    color: #666;
    border-color: rgba(128, 128, 128, 0.3);
}

/* Efecto de ripple para todos los botones */
.control-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}

.control-btn:active::before {
    width: 200px;
    height: 200px;
    opacity: 1;
}

.play-btn {
    background: var(--gradient-primary);
    flex: 1;
    min-height: 44px !important;
    padding: 12px 20px !important;
}

.pause-btn {
    background: linear-gradient(135deg, #ffaa00 0%, #ff6600 100%);
    min-height: 44px !important;
    padding: 12px 20px !important;
    font-size: 0.8rem;
    min-width: 120px !important;
    width: auto !important;
}

.reset-btn {
    background: linear-gradient(135deg, #ff00ff 0%, #aa00ff 100%);
    min-height: 44px !important;
    padding: 12px 20px !important;
}

.clear-btn {
    background: linear-gradient(135deg, #ff3366 0%, #ff0066 100%);
    min-height: 44px !important;
    padding: 12px 20px !important;
}

/* Estilo específico para botón de Super Admin */
.admin-btn {
    background: linear-gradient(135deg, #ff6b35 0%, #ff9f40 100%);
    border: 2px solid #ff6b35;
    color: white;
    position: relative;
    overflow: hidden;
    min-height: 44px !important;
    padding: 12px 20px !important;
}

.admin-btn::before {
    background: linear-gradient(135deg, #ff9f40 0%, #ff6b35 100%);
}

.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(255, 107, 53, 0.4),
        0 0 30px rgba(255, 107, 53, 0.3);
}

.admin-btn:active {
    transform: translateY(0);
    box-shadow: 
        0 4px 15px rgba(255, 107, 53, 0.3),
        0 0 20px rgba(255, 107, 53, 0.2);
}

.admin-btn i {
    color: white;
    margin-right: 8px;
}

.admin-btn span {
    font-weight: 600;
}

/* Estilo para botón de desarrollo */
.dev-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    border: 2px solid #6c757d;
    color: white;
    position: relative;
    overflow: hidden;
    opacity: 0.7;
    transition: all 0.3s ease;
    min-height: 44px !important;
    padding: 12px 20px !important;
}

.dev-btn::before {
    background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
}

.dev-btn:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(108, 117, 125, 0.4),
        0 0 30px rgba(108, 117, 125, 0.3);
}

.dev-btn.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: #28a745;
    opacity: 1;
}

.dev-btn.active::before {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
}

.dev-btn.active:hover {
    box-shadow: 
        0 8px 25px rgba(40, 167, 69, 0.4),
        0 0 30px rgba(40, 167, 69, 0.3);
}

.dev-btn i {
    color: white;
    margin-right: 8px;
}

.dev-btn span {
    font-weight: 600;
    font-size: 0.8rem;
}

/* Botones solo con icono */
.icon-only {
    min-width: 44px !important;
    width: 44px !important;
    min-height: 44px !important;
    padding: 10px 8px !important;
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.icon-only span {
    display: none;
}

/* Tooltips para botones icon-only */
.icon-only::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    border: 1px solid var(--primary-color);
    margin-bottom: 5px;
}

.icon-only:hover::after {
    opacity: 1;
    visibility: visible;
}

/* =============================
   ÁREA DEL CANVAS DEL JUEGO
   ============================= */

.game-canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(ellipse at center, rgba(0, 217, 255, 0.05) 0%, transparent 70%);
    min-height: 0; /* Permite que flex se contraiga */
    overflow: hidden;
}

/* Logo de CodePonce en el canvas */
.codeponce-logo-canvas {
    position: absolute;
    bottom: 20px;
    right: 20px;
    height: 35px;
    width: auto;
    opacity: 0.6;
    transition: all 0.3s ease;
    filter: brightness(1.1);
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
}

.codeponce-logo-canvas:hover {
    opacity: 0.9;
    transform: scale(1.05);
    filter: brightness(1.3) drop-shadow(0 0 10px rgba(0, 217, 255, 0.3));
}

#game-canvas {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px; /* Altura mínima para mantener usabilidad */
}

#game-canvas canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
}

/* =============================
   MENSAJES DEL JUEGO
   ============================= */

.game-messages {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    pointer-events: none;
}

/* .message-bubble {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-color);
    border-radius: 15px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 500px;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
} */

/* .nano-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    background: var(--gradient-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    text-align: center;
    line-height: 1;
}

.message-bubble p {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
} */

/* =============================
   MODALES
   ============================= */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--gradient-dark);
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 10px 50px rgba(0, 217, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    opacity: 0.05;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.modal-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    text-shadow: 0 0 20px currentColor;
}

.modal-content h2 i {
    margin-right: 10px;
}

.modal-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
}

.modal-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.modal-stats .stat i {
    font-size: 2rem;
    color: var(--accent-color);
}

.modal-btn {
    background: var(--gradient-primary);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 20px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 217, 255, 0.4);
}

/* Botón dentro del modal - asegurar que esté centrado y mejorado */
.modal-content .control-btn {
    display: flex;
    margin: 25px auto 0;
    text-align: center;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    padding: 12px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    min-height: 44px;
}

.modal-content .control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Mejoras específicas para el botón primario en modal */
.modal-content .primary-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0099ff 100%);
    box-shadow: 0 6px 20px rgba(0, 217, 255, 0.4);
}

.modal-content .primary-btn:hover {
    background: linear-gradient(135deg, #00f0ff 0%, #00aaff 100%);
    box-shadow: 0 8px 25px rgba(0, 217, 255, 0.6);
}

/* Mejoras específicas para el botón secundario en modal */
.modal-content .secondary-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #aa00ff 100%);
    box-shadow: 0 6px 20px rgba(255, 0, 255, 0.4);
}

.modal-content .secondary-btn:hover {
    background: linear-gradient(135deg, #ff33ff 0%, #cc00ff 100%);
    box-shadow: 0 8px 25px rgba(255, 0, 255, 0.6);
}

/* =============================
   EFECTOS ESPECIALES
   ============================= */

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 2s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--x), var(--y)) scale(0);
    }
}

/* =============================
   RESPONSIVE DESIGN
   ============================= */

@media (max-width: 1200px) {
    :root {
        --panel-width: 320px;
    }
    
    .game-canvas-container {
        min-height: 350px;
    }
}

@media (max-width: 1024px) {
    :root {
        --panel-width: 300px;
        --header-height: 60px;
    }

    .command-blocks {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .command-block {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .game-canvas-container {
        min-height: 300px;
    }
    
    .stat-item {
        padding: 10px 14px;
        font-size: 0.85rem;
        min-height: 38px;
    }
}

@media (max-width: 768px) {
    .game-main {
        flex-direction: column;
    }

    .command-panel {
        width: 100%;
        height: 320px;
        order: 2;
        border-right: none;
        position: relative;
    }


    
    .command-panel-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .commands-column {
        flex: 0 0 auto;
        max-height: 140px;
    }
    
    .programming-column {
        flex: 1;
        min-height: 120px;
    }
    
    .game-canvas-container {
        order: 1;
        min-height: 250px;
    }

    .execution-controls-footer {
        justify-content: center;
        padding: 12px 10px 8px 10px;
    }

    .play-btn {
        padding: 12px 25px;
        font-size: 0.9rem;
        min-height: 40px !important;
    }
    
    .control-btn {
        padding: 10px 16px;
        font-size: 0.75rem;
        min-height: 40px !important;
    }

    .icon-only {
        min-width: 36px !important;
        width: 36px !important;
        padding: 8px 4px !important;
    }
    
    .command-blocks {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .command-block {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    
    .code-sequence {
        min-height: 100px;
    }
    
    .codeponce-logo {
        height: 35px;
    }
    
    .codeponce-logo-canvas {
        height: 28px;
        bottom: 15px;
        right: 15px;
    }
    
    .game-stats {
        gap: 15px;
    }
    
    .stat-item {
        padding: 10px 14px;
        min-width: 80px;
        min-height: 36px;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 0.8rem;
    }
    
    .header-controls {
        gap: 12px;
    }
    
    .control-btn {
        font-size: 0.7rem;
        padding: 10px 14px !important;
        min-height: 38px !important;
    }

    /* Perfil del jugador - Tableta */
    .player-profile {
        gap: 12px;
        padding: 6px 12px;
    }
    
    .player-avatar {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .player-name {
        font-size: 0.9rem;
    }
    
    .player-experience {
        font-size: 0.75rem;
    }
    
    .logout-btn {
        width: 32px !important;
        height: 32px !important;
        padding: 6px !important;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 50px;
    }
    
    .game-header {
        padding: 8px 10px;
        flex-direction: column;
        height: auto;
        gap: 8px;
    }
    
    .header-center {
        padding: 0;
        order: 2;
    }
    
    .header-controls {
        order: 3;
        justify-content: space-between;
        width: 100%;
        gap: 8px;
    }
    
    .control-group {
        flex: 1;
        justify-content: center;
        padding: 2px;
    }
    
    .logo-section {
        order: 1;
        justify-content: center;
        width: 100%;
    }
    
    .logo-section h1 {
        font-size: 1.2rem;
    }
    
    .codeponce-logo {
        height: 30px;
    }
    
    .codeponce-logo-canvas {
        height: 25px;
        bottom: 12px;
        right: 12px;
    }
    
    .game-stats {
        gap: 8px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .stat-item {
        padding: 8px 10px;
        font-size: 0.75rem;
        min-width: 65px;
        min-height: 34px;
    }

    /* Perfil del jugador - Móvil */
    .player-profile {
        gap: 8px;
        padding: 4px 8px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .player-info {
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }
    
    .player-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .player-name {
        font-size: 0.8rem;
    }
    
    .player-experience {
        font-size: 0.65rem;
        gap: 4px;
    }
    
    .logout-btn {
        width: 28px !important;
        height: 28px !important;
        padding: 4px !important;
        margin-top: 4px;
    }

    .logout-btn i {
        font-size: 0.85rem !important;
    }
    
    .stat-label {
        font-size: 0.55rem;
    }
    
    .stat-value {
        font-size: 0.7rem;
    }
    
    .control-btn {
        font-size: 0.65rem;
        padding: 8px 12px !important;
        min-height: 36px !important;
        gap: 4px;
    }
    
    .control-btn span {
        display: none;
    }
    
    .control-btn i {
        margin: 0;
    }
    
    .command-panel {
        height: 350px;
        padding: 10px;
    }
    
    .commands-column {
        max-height: 150px;
    }
    
    .command-blocks {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    
    .command-block {
        padding: 8px;
        font-size: 0.75rem;
    }
    
    .command-block i {
        font-size: 1rem;
    }
    
    .execution-controls-footer {
        gap: 6px;
        padding: 10px 8px 6px 8px;
    }
    
        .control-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
        min-height: 36px !important;
    }

    .icon-only {
        min-width: 36px !important;
        width: 36px !important;
        padding: 8px 6px !important;
        min-height: 36px !important;
    }

    .play-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
        min-height: 36px !important;
    }
    
    .modal-content {
        margin: 20px;
        padding: 20px;
        max-width: calc(100vw - 40px);
    }
    
    .modal-content h2 {
        font-size: 1.5rem;
    }
}

/* Landscape orientation optimization for mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .game-main {
        flex-direction: row !important;
    }
    
    .command-panel {
        width: 320px !important;
        height: auto !important;
        order: 1 !important;
        border-right: 2px solid var(--primary-color) !important;
        position: relative !important;
    }

    .command-panel::after {
        display: none !important;
    }
    
    .command-panel-content {
        flex-direction: row !important;
        gap: 10px !important;
    }
    
    .commands-column {
        flex: 0 0 20% !important;
        max-height: none !important;
    }
    
    .programming-column {
        flex: 1 !important;
    }
    
    .game-canvas-container {
        order: 2 !important;
        min-height: 200px;
    }
    
    .command-blocks {
        grid-template-columns: 1fr;
    }
    
    .code-sequence {
        min-height: 80px;
    }
}

/* =============================
   SCROLLBAR PERSONALIZADA
   ============================= */

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(50, 50, 50, 0.6);
    border-radius: 2px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(80, 80, 80, 0.8);
}

/* =============================
   ANIMACIONES DE ENTRADA
   ============================= */

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

.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* =============================
   SISTEMA DE MODALIDADES DE PROGRAMACIÓN
   ============================= */

.programming-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 217, 255, 0.2);
}

.programming-header .panel-title {
    margin-bottom: 0;
}

.mode-options {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    padding: 4px;
    gap: 8px;
}

.mode-option {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--mid-text);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-option i {
    font-size: 0.9rem;
}

.mode-option:hover {
    background: rgba(0, 217, 255, 0.1);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.mode-option.active {
    background: var(--gradient-primary);
    color: var(--dark-bg);
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.3);
}

.mode-option.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.4);
}

/* Contenedor de programación */
.programming-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: auto;
    gap: 10px;
}

/* Layout para modo "ambos" */
.programming-content.both-mode {
    flex-direction: row;
    gap: 15px;
}

.programming-content.both-mode .programming-mode {
    flex: 1;
}



/* Modalidades de Programación */
.programming-mode {
    display: none;
    flex-direction: column;
    min-height: 0;
    height: auto;
    flex: 1;
}

.programming-mode.active {
    display: flex;
    height: auto;
    flex: 1;
}

/* En modo "ambos", mostrar ambos modos */
.programming-content.both-mode .programming-mode.visual-mode,
.programming-content.both-mode .programming-mode.code-mode {
    display: flex;
}

/* Ocultar panel de comandos cuando está en modo "code" únicamente */
body.mode-code .commands-column {
    display: none !important;
}

/* Expandir editor cuando está en modo código únicamente */
body.mode-code .programming-column {
    flex: 1;
    width: 100%;
}

body.mode-code .code-editor-container {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    overflow: visible;
}

/* Mejorar legibilidad cuando hay más espacio */
body.mode-code .code-editor {
    font-size: 1rem;
    line-height: 1.8;
    padding: 20px;
    min-height: 350px;
    height: auto;
    flex: 1;
}

/* Sincronizar líneas numeradas en modo código */
body.mode-code .line-numbers {
    font-size: 1rem;
    line-height: 1.8;
    padding: 20px 8px 20px 15px;
}

/* Configuraciones del modo código ya no necesarias - se usa modal */

/* Estilos mejorados para el toggle en modo código */
body.mode-code .commands-toggle-btn {
    background: rgba(0, 217, 255, 0.15);
    padding: 10px 20px;
    font-size: 0.9rem;
}

body.mode-code .commands-toggle-btn:hover {
    background: rgba(0, 217, 255, 0.25);
    box-shadow: 0 3px 12px rgba(0, 217, 255, 0.3);
}

body.mode-code .commands-toggle-container {
    border-top: 2px solid rgba(0, 217, 255, 0.4);
}

/* Editor de Código */
.code-editor-container {
    display: flex;
    flex-direction: column;
    height: auto;
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    overflow: hidden;
    min-height: 0;
    position: relative;
}

.code-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: rgba(0, 217, 255, 0.1);
    border-bottom: 1px solid rgba(0, 217, 255, 0.3);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.editor-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--mid-text);
}

.editor-info i {
    color: var(--primary-color);
}

.editor-stats {
    display: flex;
    gap: 15px;
    font-size: 0.75rem;
    color: var(--mid-text);
}

/* Contenedor del editor con líneas numeradas */
.code-editor-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

/* Área de números de línea */
.line-numbers {
    background: rgba(0, 217, 255, 0.08);
    border-right: 2px solid rgba(0, 217, 255, 0.2);
    color: var(--mid-text);
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 15px 8px 15px 15px;
    text-align: right;
    user-select: none;
    min-width: 50px;
    white-space: pre;
    overflow-y: hidden;
    overflow-x: hidden;
    flex-shrink: 0;
    position: sticky;
    left: 0;
    z-index: 10;
    margin: 0;
    border: 0;
}

.code-editor {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--light-text);
    padding: 15px 15px 15px 20px;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    resize: none;
    min-height: 250px;
    height: auto;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre;
    word-wrap: normal;
    tab-size: 4;
    margin: 0;
    border: 0;
}

.code-editor::placeholder {
    color: var(--mid-text);
    opacity: 0.7;
}

.code-editor:focus {
    background: rgba(0, 217, 255, 0.02);
}

/* Sincronización del scroll entre editor y líneas */
.code-editor-wrapper {
    overflow: hidden;
}

.code-editor {
    overflow: auto;
}

/* Scrollbar personalizada para el editor */
.code-editor::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-editor::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.code-editor::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 4px;
    border: 1px solid rgba(0, 217, 255, 0.1);
}

.code-editor::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}

.code-editor::-webkit-scrollbar-corner {
    background: rgba(0, 0, 0, 0.2);
}

/* Mejora visual para el scroll horizontal */
.code-editor::-webkit-scrollbar:horizontal {
    height: 8px;
}

/* Efecto de resaltado en la línea actual */
.code-editor:focus {
    background: 
        linear-gradient(
            rgba(0, 217, 255, 0.03) 0%,
            rgba(0, 217, 255, 0.02) 100%
        );
}

/* Prevenir selección de texto en líneas numeradas */
.line-numbers {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -ms-overflow-style: none;  /* IE y Edge */
    scrollbar-width: none;  /* Firefox */
    box-shadow: inset -1px 0 0 rgba(0, 217, 255, 0.1);
}

/* Ocultar scroll horizontal en las líneas numeradas */
.line-numbers::-webkit-scrollbar:horizontal {
    display: none;
}

/* Efecto hover en las líneas numeradas */
.line-numbers:hover {
    background: rgba(0, 217, 255, 0.12);
}

/* Contenedor del botón toggle */
.commands-toggle-container {
    flex-shrink: 0;
    border-top: 1px solid rgba(0, 217, 255, 0.2);
    position: relative;
    z-index: 15;
}

.commands-toggle-btn {
    width: 100%;
    background: rgba(0, 217, 255, 0.1);
    border: none;
    color: var(--primary-color);
    padding: 8px 15px;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    position: relative;
}

.commands-toggle-btn:hover {
    background: rgba(0, 217, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.2);
}

.commands-toggle-btn:active {
    transform: translateY(1px);
}



.commands-toggle-btn span {
    flex: 1;
    text-align: left;
    margin-left: 8px;
}

/* Sección de ayuda con comandos - Oculta por defecto */
.code-editor-help {
    display: none;
}

.code-editor-help h4 {
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-bottom: 10px;
    font-weight: 600;
    text-shadow: 0 0 5px currentColor;
    border-bottom: 1px solid rgba(0, 255, 136, 0.3);
    padding-bottom: 5px;
}

.help-commands {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* =============================
   MODAL DE COMANDOS
   ============================= */

.commands-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.commands-modal.active {
    opacity: 1;
    visibility: visible;
}

.commands-modal-content {
    background: var(--gradient-dark);
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    padding: 30px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(0, 217, 255, 0.3);
    transform: scale(0.9) translateY(30px);
    transition: all 0.3s ease;
    position: relative;
}

.commands-modal.active .commands-modal-content {
    transform: scale(1) translateY(0);
}

.commands-modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.commands-modal-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 0 0 15px currentColor;
}

.commands-modal-header p {
    color: var(--mid-text);
    font-size: 1rem;
    line-height: 1.5;
}

.commands-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.command-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 60px;
}

.command-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.command-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(0, 217, 255, 0.2);
    transform: translateY(-2px);
}

.command-card:hover::before {
    left: 100%;
}

.command-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.command-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

.command-name {
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 700;
}

.command-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.command-description {
    color: var(--light-text);
    line-height: 1.4;
    margin-bottom: 0;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.command-example {
    background: rgba(0, 217, 255, 0.1);
    border-left: 3px solid var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.commands-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--mid-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.commands-modal-close:hover {
    color: var(--primary-color);
    background: rgba(0, 217, 255, 0.1);
    transform: rotate(90deg);
}

.commands-modal-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 217, 255, 0.2);
}

.insert-command-btn {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0;
    flex-shrink: 0;
    align-self: center;
    white-space: nowrap;
}

.insert-command-btn:hover {
    background: var(--gradient-secondary);
    box-shadow: 0 2px 10px rgba(0, 217, 255, 0.3);
    transform: translateY(-1px);
}

/* Responsive para el modal de comandos */
@media (max-width: 768px) {
    .commands-modal-content {
        padding: 20px;
        max-width: 95%;
        max-height: 85vh;
    }
    
    .commands-modal-header h2 {
        font-size: 1.4rem;
    }
    
    .commands-grid {
        gap: 10px;
    }
    
    .command-card {
        padding: 10px 12px;
        min-height: 50px;
        gap: 10px;
    }
    
    .command-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .command-name {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .commands-modal-content {
        padding: 15px;
        border-radius: 15px;
    }
    
    .commands-modal-header {
        margin-bottom: 20px;
    }
    
    .commands-modal-header h2 {
        font-size: 1.2rem;
    }
    
    .commands-modal-header p {
        font-size: 0.9rem;
    }
    
    .command-card {
        padding: 8px 10px;
        min-height: 45px;
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .command-header {
        gap: 8px;
    }
    
    .command-icon {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
    
    .command-name {
        font-size: 0.9rem;
    }
    
    .command-info {
        gap: 3px;
    }
    
    .command-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 1;
    }
    
    .command-example {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    .insert-command-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
        align-self: stretch;
        margin-top: 5px;
    }
}

.help-cmd {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-family: 'Space Mono', monospace;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.help-cmd:hover {
    background: rgba(0, 217, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 217, 255, 0.3);
}

.help-cmd:active {
    transform: translateY(0);
    background: rgba(0, 217, 255, 0.3);
}

/* Estados de error y validación */
.code-editor.error {
    border-color: var(--error-color);
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.3);
}

.code-editor.success {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

/* Indicador de línea con error */
.error-indicator {
    position: absolute;
    right: 15px;
    background: var(--error-color);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* =============================
   RESPONSIVE PARA MODALIDADES
   ============================= */

@media (max-width: 1024px) {
    .mode-option {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    .mode-option i {
        font-size: 0.8rem;
    }
    
    .programming-content.both-mode {
        flex-direction: column;
        gap: 10px;
    }
    
    .line-numbers {
        font-size: 0.8rem;
        line-height: 1.6;
        padding: 12px 6px 12px 12px;
        min-width: 45px;
    }
    
    .code-editor {
        font-size: 0.8rem;
        line-height: 1.6;
        padding: 12px 12px 12px 15px;
    }
}

@media (max-width: 768px) {
    .programming-header {
        margin-bottom: 10px;
    }
    
    
    .mode-option {
        padding: 5px 6px;
        font-size: 0.7rem;
    }
    
    .mode-option span {
        display: none;
    }
    
    .mode-option i {
        font-size: 0.9rem;
    }
    
    .programming-content.both-mode {
        flex-direction: column;
        gap: 8px;
    }
    
    .line-numbers {
        font-size: 0.75rem;
        line-height: 1.6;
        padding: 10px 5px 10px 10px;
        min-width: 40px;
    }

    .code-editor {
        min-height: 120px;
        font-size: 0.75rem;
        line-height: 1.6;
        padding: 10px 10px 10px 12px;
    }
    
    .code-editor::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    .code-editor-help {
        padding: 8px 10px;
    }
    
    .help-commands {
        gap: 4px;
    }
    
    .help-cmd {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
}

@media (max-width: 480px) {
    .programming-header {
        margin-bottom: 8px;
    }
    
    .mode-option {
        padding: 4px 5px;
        font-size: 0.65rem;
    }
    
    .mode-option span {
        display: none;
    }
    
    .mode-option i {
        font-size: 0.8rem;
    }
    
    .programming-content.both-mode {
        flex-direction: column;
        gap: 6px;
    }
    
    .line-numbers {
        font-size: 0.7rem;
        line-height: 1.5;
        padding: 8px 4px 8px 8px;
        min-width: 35px;
    }

    .code-editor {
        min-height: 100px;
        font-size: 0.7rem;
        line-height: 1.5;
        padding: 8px 8px 8px 10px;
    }
    
    .code-editor::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    
    .code-editor-header {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
    
    .editor-stats {
        gap: 10px;
        font-size: 0.65rem;
    }
}

/* ==========================================
   MODALES DE OBJETIVO Y MUNDOS
   ========================================== */

/* Modal de Objetivo */
#objective-modal .modal-content {
    max-width: 600px;
    padding: 30px;
}

#objective-content {
    text-align: center;
}

#level-name {
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 20px;
    font-family: 'Orbitron', monospace;
}

#level-objective {
    font-size: 1.1rem;
    color: var(--light-text);
    margin-bottom: 25px;
    line-height: 1.6;
}

.hint-section {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.optimal-moves {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 8px;
    padding: 15px;
}

/* Modal de Mundos */
.worlds-modal-content {
    max-width: 900px;
    max-height: 80vh;
    overflow-y: auto;
}

#worlds-container {
    display: grid;
    gap: 20px;
    padding: 20px 0;
}

.world-section {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.3s ease;
}

.world-section:hover {
    transform: translateY(-2px);
}

.world-section.locked {
    opacity: 0.5;
    border-color: #666;
    cursor: not-allowed;
}

.world-section.coming-soon {
    border-color: #aa66ff;
    background: rgba(170, 102, 255, 0.1);
}

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

.world-title {
    font-size: 1.4rem;
    font-family: 'Orbitron', monospace;
    color: var(--primary);
}

.world-status {
    font-size: 0.9rem;
    color: var(--mid-text);
}

.world-description {
    color: var(--light-text);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.world-levels {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.level-button {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--primary);
    border-radius: 8px;
    color: var(--light-text);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.level-button:hover:not(:disabled) {
    background: var(--primary);
    color: var(--bg-dark);
    transform: scale(1.1);
}

.level-button.completed {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
}

.level-button.completed::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 5px;
    font-size: 0.8rem;
    color: #00ff88;
}

.level-button.current {
    background: rgba(0, 217, 255, 0.3);
    border-color: #00d9ff;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.5);
}

.level-button.locked {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #666;
}

.level-button.locked:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
}

/* Botón cerrar para las nuevas modales */
#objective-modal .close,
#worlds-modal .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--mid-text);
    transition: color 0.3s ease;
}

#objective-modal .close:hover,
#worlds-modal .close:hover {
    color: var(--primary);
}

/* =============================
   ANIMACIONES PARA NOTIFICACIONES
   ============================= */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes unlockAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes unlockAnimationOut {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
}

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

/* ===== ESTILOS PARA CONSTRUCTOR DE CONDICIONES ===== */

.conditional-builder {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
    animation: fadeIn 0.5s ease;
}

.conditional-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
    color: #00d9ff;
    font-weight: 600;
    font-size: 14px;
}

.conditional-header i {
    color: #ffaa00;
}

.conditional-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-row label {
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}

.form-row select,
.form-row input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 5px;
    padding: 8px 10px;
    color: #fff;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
}

.form-row select:focus,
.form-row input:focus {
    outline: none;
    border-color: #00d9ff;
    box-shadow: 0 0 5px rgba(0, 217, 255, 0.3);
}

.form-row input::placeholder {
    color: #666;
    font-style: italic;
}

.insert-if-btn {
    background: linear-gradient(45deg, #00d9ff, #00ff88);
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    color: #000;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.insert-if-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 217, 255, 0.3);
}

.insert-if-btn:active {
    transform: translateY(0);
}

.conditional-examples {
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    border-left: 3px solid #ffaa00;
}

.conditional-examples .example {
    font-size: 11px;
    color: #ccc;
    line-height: 1.4;
}

.conditional-examples code {
    background: rgba(0, 217, 255, 0.1);
    color: #00d9ff;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    display: block;
    margin-top: 5px;
    word-break: break-all;
}

.conditional-block {
    background: linear-gradient(135deg, #8B00FF, #4B0082) !important;
    border-color: #8B00FF !important;
}

.conditional-block:hover {
    background: linear-gradient(135deg, #9932CC, #6A0DAD) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 0, 255, 0.3);
}

/* Estilos para mensajes del juego */
.message-bubble {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    max-width: 500px;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.message-bubble.message-success {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.message-bubble.message-error {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

.message-bubble.message-warning {
    border-color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

.message-bubble.message-info {
    border-color: var(--primary-color);
    background: rgba(0, 217, 255, 0.1);
}

.nano-avatar {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message-bubble p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.4;
    font-size: 0.95rem;
}

/* Estilos para el modal de registro de usuario */
.user-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: radial-gradient(ellipse at center, #10131a 0%, #05080d 100%) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    backdrop-filter: blur(8px) !important;
    animation: fadeIn 0.5s;
}
.user-modal.active {
    display: flex !important;
}

.user-modal-content {
    background: linear-gradient(135deg, #0a223a 0%, #0e0e1a 100%) !important;
    border: 2.5px solid #00d9ff !important;
    border-radius: 22px !important;
    padding: 38px 32px 32px 32px !important;
    max-width: 410px !important;
    width: 92vw !important;
    text-align: center !important;
    box-shadow: 0 8px 40px 0 rgba(0,217,255,0.18), 0 2px 24px 0 rgba(0,0,0,0.7) !important;
    position: relative !important;
    z-index: 1000000 !important;
    color: #fff !important;
    animation: modalZoomIn 0.5s;
}

.user-modal-content h2 {
    color: #00d9ff !important;
    margin-bottom: 18px !important;
    font-size: 2.1rem !important;
    font-family: 'Orbitron', 'Space Mono', monospace;
    text-shadow: 0 0 18px #00d9ff55;
    letter-spacing: 1px;
}

.user-modal-content p {
    color: #b0b0b0 !important;
    margin-bottom: 28px !important;
    line-height: 1.5 !important;
    font-size: 1.08rem !important;
}

#user-registration-form {
    text-align: left !important;
}

.form-group {
    margin-bottom: 22px !important;
}

.form-group label {
    display: block !important;
    margin-bottom: 7px !important;
    color: #00d9ff !important;
    font-weight: 700 !important;
    font-size: 1.01rem !important;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100% !important;
    padding: 13px 16px !important;
    border: 2px solid #00d9ff55 !important;
    border-radius: 9px !important;
    background: rgba(0, 0, 0, 0.55) !important;
    color: #fff !important;
    font-size: 1.01rem !important;
    transition: all 0.3s !important;
    box-sizing: border-box !important;
    font-family: 'Space Mono', monospace !important;
    outline: none !important;
}

.form-group input:focus {
    border-color: #00d9ff !important;
    box-shadow: 0 0 0 2px #00d9ff44 !important;
    background: rgba(0, 0, 0, 0.75) !important;
}

.form-group input::placeholder {
    color: #7befff !important;
    opacity: 0.7 !important;
    font-style: italic;
}

.form-actions {
    text-align: center !important;
    margin-top: 30px !important;
}

.form-actions .control-btn {
    background: linear-gradient(90deg, #00d9ff 0%, #00ff88 100%) !important;
    border: none !important;
    color: #0a223a !important;
    padding: 15px 38px !important;
    border-radius: 12px !important;
    font-size: 1.08rem !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    box-shadow: 0 4px 18px 0 #00d9ff44 !important;
    font-family: 'Orbitron', 'Space Mono', monospace;
    position: relative;
    overflow: hidden;
}

.form-actions .control-btn:hover, .form-actions .control-btn:focus {
    background: linear-gradient(90deg, #00ff88 0%, #00d9ff 100%) !important;
    color: #0e0e1a !important;
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 32px 0 #00d9ff77 !important;
}


/* Animación para cuando aparece el constructor */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }

}

/* =============================
   ESTILOS PARA BLOQUES CONDICIONALES CONTENEDORES
   ============================= */

/* Bloques condicionales contenedores principales */
.command-block.conditional-container {
    background: linear-gradient(135deg, #2d4a6e 0%, #1e3a5f 100%);
    border: 2px solid #4a90e2;
    border-radius: 12px;
    padding: 15px;
    margin: 8px 0;
    position: relative;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

/* Removed hover effect to prevent usability issues with dropdowns and inputs */
.command-block.conditional-container:hover {
    /* border-color: #5aa3f0;
    box-shadow: 0 6px 12px rgba(74, 144, 226, 0.4); */
}

/* Header de la condición */
.command-block.conditional-container .condition-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(74, 144, 226, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Removed hover effect to prevent interference with interactive elements */
.command-block.conditional-container .condition-header:hover {
    /* background: rgba(74, 144, 226, 0.3); */
}

.command-block.conditional-container .condition-text {
    font-weight: bold;
    color: #4a90e2;
    flex-grow: 1;
    font-size: 14px;
}

.command-block.conditional-container .condition-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #4a90e2;
    border-radius: 4px;
    padding: 4px 8px;
    color: white;
    font-size: 12px;
    margin-left: 10px;
    cursor: pointer;
}

/* Removed hover effect to allow proper dropdown functionality */
.command-block.conditional-container .condition-select:hover {
    /* border-color: #5aa3f0; */
}

/* Ramas IF y ELSE */
.command-block.conditional-container .if-branch,
.command-block.conditional-container .else-branch {
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed #666;
    border-radius: 8px;
    padding: 10px;
    margin: 5px 0;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all 0.3s ease;
    position: relative;
}

.command-block.conditional-container .if-branch {
    border-color: #00ff88;
}

.command-block.conditional-container .else-branch {
    border-color: #ff6b6b;
}

/* Labels de las ramas */
.command-block.conditional-container .branch-label {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 5px;
    position: absolute;
    top: -8px;
    left: 8px;
    background: var(--bg-dark);
    padding: 0 4px;
}

.command-block.conditional-container .if-branch .branch-label {
    color: #00ff88;
}

.command-block.conditional-container .else-branch .branch-label {
    color: #ff6b6b;
}

/* Placeholder para ramas vacías */
.command-block.conditional-container .branch-placeholder {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 15px;
    font-size: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    margin: 5px 0;
}

/* Estados de drag over */
.command-block.conditional-container .if-branch.drag-over {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    border-style: solid;
    box-shadow: inset 0 0 10px rgba(0, 255, 136, 0.3);
}

.command-block.conditional-container .else-branch.drag-over {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border-style: solid;
    box-shadow: inset 0 0 10px rgba(255, 107, 107, 0.3);
}

/* Comandos anidados */
.command-block.conditional-container .nested-command {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 2px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: grab;
    transition: all 0.2s ease;
    font-size: 13px;
}

/* Removed hover effect to prevent movement that interferes with interactions */
.command-block.conditional-container .nested-command:hover {
    /* background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); */
}

.command-block.conditional-container .nested-command:active {
    cursor: grabbing;
}

.command-block.conditional-container .nested-command.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
}

.command-block.conditional-container .nested-command .nested-icon {
    color: #4a90e2;
    font-size: 14px;
}

.command-block.conditional-container .nested-command .nested-name {
    color: white;
    font-weight: 500;
}

/* Botón para remover comandos anidados */
.command-block.conditional-container .nested-command .remove-nested {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    opacity: 0.7;
    transition: all 0.2s ease;
    font-size: 12px;
}

.command-block.conditional-container .nested-command .remove-nested:hover {
    opacity: 1;
    background: rgba(255, 107, 107, 0.2);
}

/* Botón para agregar rama ELSE */
.command-block.conditional-container .add-else-btn {
    background: rgba(255, 107, 107, 0.2);
    border: 1px dashed #ff6b6b;
    border-radius: 6px;
    padding: 8px;
    color: #ff6b6b;
    cursor: pointer;
    text-align: center;
    margin-top: 10px;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 500;
}

.command-block.conditional-container .add-else-btn:hover {
    background: rgba(255, 107, 107, 0.3);
    border-style: solid;
}

/* Botón para remover rama ELSE */
.command-block.conditional-container .remove-else-btn {
    background: transparent;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 10px;
    opacity: 0.7;
    position: absolute;
    top: -5px;
    right: 5px;
    padding: 2px 4px;
    border-radius: 3px;
}

.command-block.conditional-container .remove-else-btn:hover {
    opacity: 1;
    background: rgba(255, 107, 107, 0.2);
}

/* Indicadores de drop para branches */
.command-block.conditional-container .branch-drop-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #00d9ff;
    border-radius: 1px;
    box-shadow: 0 0 4px #00d9ff;
    z-index: 100;
    transition: all 0.2s ease;
}

/* Animaciones de entrada */
.command-block.conditional-container .nested-command.new-command {
    animation: slideInFromLeft 0.5s ease-out;
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Estilos responsivos */
@media (max-width: 768px) {
    .command-block.conditional-container {
        padding: 10px;
        margin: 5px 0;
    }
    
    .command-block.conditional-container .condition-header {
        padding: 6px 8px;
        flex-direction: column;
        gap: 5px;
    }
    
    .command-block.conditional-container .condition-select {
        margin-left: 0;
        width: 100%;
    }
    
    .command-block.conditional-container .if-branch,
    .command-block.conditional-container .else-branch {
        padding: 8px;
        min-height: 50px;
    }
}

/* Animación de pulso */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===== ESTILOS UNIFICADOS PARA BOTONES DE ELIMINACIÓN ===== */
/* Sobrescribir todos los estilos de botones de eliminación para unificarlos */
.command-block .remove-command,
.command-block.conditional-container .remove-command,
.command-block.loop-container .remove-command,
.placed-command .remove-command {
    position: absolute !important;
    top: -8px !important;
    right: -8px !important;
    background: #ff6b6b !important;
    border: none !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 10px !important;
    cursor: pointer !important;
    z-index: 10 !important;
    transition: all 0.2s ease !important;
    opacity: 0 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.command-block:hover .remove-command,
.command-block.conditional-container:hover .remove-command,
.command-block.loop-container:hover .remove-command,
.placed-command:hover .remove-command {
    opacity: 1 !important;
}

.command-block .remove-command:hover,
.command-block.conditional-container .remove-command:hover,
.command-block.loop-container .remove-command:hover,
.placed-command .remove-command:hover {
    background: #ff5252 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4) !important;
}

/* Estilos especiales para comandos anidados en condicionales y bucles */
.nested-command .remove-nested,
.loop-nested-command .remove-command {
    position: absolute !important;
    top: -6px !important;
    right: -6px !important;
    background: #ff6b6b !important;
    border: none !important;
    border-radius: 50% !important;
    width: 16px !important;
    height: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 8px !important;
    cursor: pointer !important;
    z-index: 10 !important;
    transition: all 0.2s ease !important;
    opacity: 0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

.nested-command:hover .remove-nested,
.loop-nested-command:hover .remove-command {
    opacity: 1 !important;
}

.nested-command .remove-nested:hover,
.loop-nested-command .remove-command:hover {
    background: #ff5252 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

/* Asegurar que los comandos tengan posición relativa para los botones absolutos */
.command-block,
.placed-command,
.nested-command,
.loop-nested-command {
    position: relative !important;
}

/* Animación de confirmación al eliminar */
.command-block.removing,
.placed-command.removing,
.nested-command.removing {
    animation: fadeOutScale 0.3s ease forwards;
}

@keyframes fadeOutScale {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* =============================
   RESALTADO DE LÍNEAS DE CÓDIGO DURANTE EJECUCIÓN
   ============================= */

/* Línea que se está ejecutando actualmente */
.code-editor.line-highlight::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1.2em;
    background: linear-gradient(90deg, rgba(0, 217, 255, 0.15) 0%, rgba(0, 217, 255, 0.05) 100%);
    border-left: 3px solid var(--primary-color);
    pointer-events: none;
    z-index: 1;
    animation: codeLineExecute 0.3s ease-in-out;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

@keyframes codeLineExecute {
    0% {
        background: rgba(0, 255, 136, 0.3);
        border-left-color: var(--accent-color);
        transform: scaleX(0);
        transform-origin: left;
    }
    50% {
        background: rgba(0, 217, 255, 0.2);
        border-left-color: var(--primary-color);
        transform: scaleX(1);
    }
    100% {
        background: rgba(0, 217, 255, 0.15);
        border-left-color: var(--primary-color);
        transform: scaleX(1);
    }
}

/* Contenedor para posicionar el resaltado correctamente */
.code-editor-wrapper {
    position: relative;
}

.code-line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    height: 1.2em;
    background: linear-gradient(90deg, rgba(0, 217, 255, 0.15) 0%, rgba(0, 217, 255, 0.05) 100%);
    border-left: 3px solid var(--primary-color);
    pointer-events: none;
    z-index: 1;
    animation: codeLineExecute 0.3s ease-in-out;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
    transition: top 0.2s ease;
}

/* Efecto de pulso para líneas de error */
.code-line-highlight.error {
    background: linear-gradient(90deg, rgba(255, 51, 102, 0.2) 0%, rgba(255, 51, 102, 0.05) 100%);
    border-left-color: var(--error-color);
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.4);
    animation: errorLinePulse 0.5s ease-in-out;
}

@keyframes errorLinePulse {
    0%, 100% {
        background: rgba(255, 51, 102, 0.2);
        transform: scaleX(1);
    }
    50% {
        background: rgba(255, 51, 102, 0.4);
        transform: scaleX(1.02);
    }
}

/* Línea completada con éxito */
.code-line-highlight.success {
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.2) 0%, rgba(0, 255, 136, 0.05) 100%);
    border-left-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

/* Líneas ya ejecutadas (rastro) */
.code-line-highlight.executed {
    background: linear-gradient(90deg, rgba(176, 176, 176, 0.1) 0%, rgba(176, 176, 176, 0.02) 100%);
    border-left: 2px solid rgba(176, 176, 176, 0.3);
    box-shadow: none;
    animation: none;
}

/* Indicador de progreso de ejecución */
.code-execution-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    background: var(--primary-color);
    transition: height 0.3s ease;
    z-index: 2;
    box-shadow: 0 0 5px rgba(0, 217, 255, 0.6);
}

/* Mejoras responsivas para el resaltado */
@media (max-width: 768px) {
    .code-line-highlight {
        border-left-width: 2px;
        box-shadow: 0 0 5px rgba(0, 217, 255, 0.3);
    }
    
    .code-execution-progress {
        width: 1px;
    }
}